diff options
Diffstat (limited to 'pseudocode-lib/_exp_string.cc')
| -rw-r--r-- | pseudocode-lib/_exp_string.cc | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/pseudocode-lib/_exp_string.cc b/pseudocode-lib/_exp_string.cc index ada7c8c..d881187 100644 --- a/pseudocode-lib/_exp_string.cc +++ b/pseudocode-lib/_exp_string.cc @@ -73,6 +73,13 @@ void _exp_string_impl_left(void *Target, void *Handle, long long Count) { text(Target) = Source.substr(0, Length); }); } +void _exp_string_impl_right(void *Target, void *Handle, long long Count) { + checked([&] { + const auto &Source = text(Handle); + auto Length = Count <= 0 ? 0 : std::min(static_cast<std::size_t>(Count), Source.size()); + text(Target) = Source.substr(Source.size() - Length, Length); + }); +} void _exp_string_impl_output(void *Handle) { checked([&] { const auto &Text = text(Handle); |
