diff options
| author | maxim-yurchuk <[email protected]> | 2024-10-09 12:29:46 +0300 |
|---|---|---|
| committer | maxim-yurchuk <[email protected]> | 2024-10-09 13:14:22 +0300 |
| commit | 9731d8a4bb7ee2cc8554eaf133bb85498a4c7d80 (patch) | |
| tree | a8fb3181d5947c0d78cf402aa56e686130179049 /contrib/python/pythran/pythran/pythonic/builtins/str/lstrip.hpp | |
| parent | a44b779cd359f06c3ebbef4ec98c6b38609d9d85 (diff) | |
publishFullContrib: true for ydb
<HIDDEN_URL>
commit_hash:c82a80ac4594723cebf2c7387dec9c60217f603e
Diffstat (limited to 'contrib/python/pythran/pythran/pythonic/builtins/str/lstrip.hpp')
| -rw-r--r-- | contrib/python/pythran/pythran/pythonic/builtins/str/lstrip.hpp | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/contrib/python/pythran/pythran/pythonic/builtins/str/lstrip.hpp b/contrib/python/pythran/pythran/pythonic/builtins/str/lstrip.hpp new file mode 100644 index 00000000000..d3a031bfede --- /dev/null +++ b/contrib/python/pythran/pythran/pythonic/builtins/str/lstrip.hpp @@ -0,0 +1,29 @@ +#ifndef PYTHONIC_BUILTIN_STR_LSTRIP_HPP +#define PYTHONIC_BUILTIN_STR_LSTRIP_HPP + +#include "pythonic/include/builtins/str/lstrip.hpp" + +#include "pythonic/types/str.hpp" +#include "pythonic/utils/functor.hpp" + +PYTHONIC_NS_BEGIN + +namespace builtins +{ + + namespace str + { + + types::str lstrip(types::str const &self, types::str const &to_del) + { + auto chars = self.chars(); + auto stop = self.find_first_not_of(to_del); + if (stop < 0) + return {}; + else + return {chars.begin() + stop, chars.end()}; + } + } +} +PYTHONIC_NS_END +#endif |
