For every method or property of a class, when the return type is "int", "str" or "list", it's not going to be an int
a str
or a list
but an ExentdedInt
, ExtendedString
and ExtendedList
str: int
Return the string converted to an extended int
str: float
Return the string converted to a flaot
str: list[str]
Return an extended list of each char in the string
str: str
Equivalent to str.lower()
str: str
Equivalent to str.upper()
str: str
Equivalent to str.capitalize()
str: str
Equivalent to str.title()
str: str
Convert the string from a camelCase to a snake_case
str: str
Convert the string from a snake_case to a PascalCase
str: str
Convert the string from a snake_case to a camelCase
str: int
Return the sum of all the ords in the string
sum(map(ord,str))
str: int
Return how many times, the char changed.
aaabccccddddaaa
000122223333444
So chr_change will return 4
str: int
Equivalent to len(str)
str: int
Max of ord of the string
str: int
Min of ord of the string
str: str
Filter alpha char
str: str
Filter alnum char
str: str
Filter digit char
str: str
Filter upper char
str: str
Filter lower char
str: str
Filter vowels char
str: str
Filter consomns char
str: function -> str | list[any]
Equivalent of list(map(function, str))
.
If all elements returned by the map are string, it will join them, else it will return the list
Example:
"abcde".m(lambda c: chr(c.ord+1)) # "bcdef"
"abcde".m(lambda c: c.ord + 1) # [98, 99, 100, 101, 102]
str: function -> str
Equivalent of "".join(filter(function, str))
.
Example:
"abcdefabcdef".f(lambda c: c <= 'c') # abcabc
"abcdefabcdef".f(lambda c: c > 'c') # defdef
str: str | list -> str
The first argument, is the char to remove or the list of char to remove.
Example:
"abcdef".rm("abc") # def
"abcdef".rm(['a', 'c', 'e']) # bdf
str: str | function -> int
If the argument is a str, it's just the equivalent of str1.count(str2)
Else, it's a lambda function that counts how many times does it match.
Which is the same as
sum(map(function, str))
or
len(filter(function, str))
Example:
"abcdefghijkl".cnt(lambda c: c <= 'e') # 5 (a,b,c,d,e)
"abcdefghijkl".cnt(lambda c: c > 'e') # 7 (f,g,h,i,j,k,l)
str: int -> str
Rotate the ord of alphabetical char.
Example:
"abcDEF".rotate_ord(1) # "bcdEFG"
str: int -> str
Rotate the string
Example:
"abcdef".rotate(1) # "fabcde"
"abcdef".rotate(-1) # "bcdefa"
str: int -> list[str]
Split a string every n char.
Example:
"abc".n_split(2) # ["ab", "c"]
"abcdef".n_split(3) # ["abc", "def"]
str: regex -> list[str]
Equivalent to
re.findall(regex, str)
str: regex, str -> str
Equivalent to
re.sub(regex, str, self)
str: regex -> int
The index of the match in the string
str: int -> str
Will return str[:-int]
str: str -> str
Will remove every occurences of every char in the string in argument.
Example:
"abcdef"/"abc" # def
"CaseMatter"/"ca" # CseMtter
str: str -> str
Equivalent to str.split(_arg_str)
list: int
Equivalent to len(list)
list: int
Equivalent to min(list)
list: int
Equivalent to max(list)
list: int
Equivalent to sum(list)
list: function -> list
Same as str.m()
list: function -> list
Same as str.f()
list: any -> list
Same as str.rm()
list: any -> int
Same as str.cnt()
list: str -> str
Equivalent to
str.join(list)
list: int -> list
Same as list[:-int]
list: list -> list
Remove every element from self
that are also in the list in argument (as in ruby)
Example:
[3, 4, 5, 6, 5] - [3, 5, 3] # [4, 6]
int: str
Equivalent of str(int)
int: str
Equivalent of chr(int)
int: bool
Return true if the int is a prime. Else false
int: int
Count the number of 1 in the binary expression
int: int
Count the number of 0 in the binary expression
int: int
The length of the binary expression when you remove trailing 0
(0b11101).len # 5
(0b011101).len # 5
(31).len # 5
(32).len # 6
int: int,int -> bool
Say if the number is a fibonacci number, with the 2 first term being thoses in parameter
int: int -> list[int]
Equivalent of range(a,b)
int: int -> int
The n-th bit.