mirror of
https://github.com/erg-lang/erg.git
synced 2025-09-28 04:09:05 +00:00
Add some builtin types methods
This commit is contained in:
parent
c97b8d61ad
commit
c44355346e
4 changed files with 160 additions and 1 deletions
|
@ -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):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue