Add some builtin types methods

This commit is contained in:
Shunsuke Shibayama 2023-02-03 13:34:16 +09:00
parent c97b8d61ad
commit c44355346e
4 changed files with 160 additions and 1 deletions

View file

@ -19,6 +19,8 @@ class Str(str):
return StrMut(self)
def to_int(self):
return Int(self) if self.isdigit() else None
def contains(self, s):
return s in self
def __add__(self, other):
return then__(str.__add__(self, other), Str)
def __radd__(self, other):