~repos /plum
git clone https://pyrossh.dev/repos/plum.git
A statically typed, imperative programming language inspired by rust, python
libs/std/str.plum
module std/str
`Any type that can be converted to a str needs to implement this traittrait Stringable = toStr() -> Str
`A Str is an array of contiguous data stored in memory with a null termination using hex 0x00 or ASCII 0x00.`It is immutable and cannot be modified. It is copied for any changes and saved to a new memory location.`The previous str is freed if its reference count is 0 within the block.type Str is Comparable, Stringable, Readable, Writable = data: Buffer
get(i: Int) -> Char = data.get(i)
contains(self, search: Str) -> Bool = todo
indexOf(self, sub: Str) -> Int = todo
test(self, pattern: Regex) -> Bool = todo
search(key: Str) -> (Int, Bool) = low, mid, high = 0, 0, n.numItems while low < high mid = (low + high) / 2 cmp = key > n.items[mid].key low = cmp > 0 ? mid + 1 : low high = cmp < 0 ? mid : high if cmp == 0 then return (mid, True) (low, False)
startsWith(search: str) -> Bool = todo
concat(other: Str) -> Str = s + other
toStr(self) -> Str = self
matchPattern(self, pattern: Regex) -> List<Str> = todo
matchAll(self, pattern: Regex) -> List<Str> = todo
padStart(self, sub: Str, count: Int) -> Str = todo
padEnd(self, sub: Str, count: Int) -> Str = todo
repeat(self, count: Int) -> Str = todo
replace(pattern: Regex, sub: Str) -> Str = todo
replaceAll(pattern: Regex, sub: Str) -> Str = todo
search(pattern: Regex) -> Str = todo
slice(start: Int, e: Int) -> Str = todo
split(separator: Str, limit: Int) -> []Str = todo
sub(start: Int, e: Int) -> Str = todo
toLower() -> Str = todo
# reverses a Str reverse() -> Str = start := 0 end := length - 1 result := [] while start < end const temp = data[start] result[start] = data[end] result[end] = temp end = end - 1 start = start + 1 result
camelCase() -> Str = todo
snakeCase() -> Str = todo
capitalize() -> Str = todo
kebabCase() -> Str = todo
lowerCase() -> Str = todo
lowerFirst() -> Str = todo
upperCase() -> Str = todo
upperFirst() -> Str = todo
startCase() -> Str = todo
deburr() -> Str = todo
escape() -> Str = todo
escapeRegExp() -> Str = todo
pad() -> Str = todo
template() -> Str = todo
trim() -> Str = todo
trimEnd() -> Str = todo
trimStart() -> Str = todo
truncate() -> Str = todo
unescape() -> Str = todo
words() -> Str = todo