util.strings.substring
Return a substring from a string using start
and end
as index values. If end
is None, it will return the length to the end of the string from start
. Negative numbers are permitted to designate distance from the end of the string.
Arguments:
def util.strings.substring(
s: str = None,
start: int, dec = 0,
end: int, dec = None,
):
Returns a string.
Example:
s = "hello world"
util.strings.substring(s=s, end=5) # 'hello'
util.strings.substring(s=s, start=6) # 'world'
util.strings.substring(s=s, start=1, end=5) # 'ello'
util.strings.substring(s=s, end=-6) # 'hello'
util.strings.substring(s=s, end=-999, end=-999) # ''