Skip to content

Commit

Permalink
update string type
Browse files Browse the repository at this point in the history
  • Loading branch information
mertcandav committed Dec 21, 2023
1 parent fb2a129 commit 44407b6
Showing 1 changed file with 0 additions and 50 deletions.
50 changes: 0 additions & 50 deletions src/types/strings.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,53 +4,3 @@
`len: int`
Character count of string.
It is can constant if string is literal.

## Methods
`fn has_prefix(self, sub: str): bool`\
Reports string has prefix as specified substring or not.

---

`fn has_suffix(self, sub: str): bool`\
Reports string has suffix as specified substring or not.

---

`fn find(self, sub: str): int`\
Returns index of first matched item with specified substring, returns -1 if not exist any match.\
Starts searching at left of string to right.

---

`fn rfind(self, sub: str): int`\
Returns index of first matched item with specified substring, returns -1 if not exist any match.\
Starts searching at right of string to left.

---

`fn ltrim(self, bytes: str): str`\
Trims string by specified bytes at left. Each character is each byte.

---

`fn rtrim(self, bytes: str): str`\
Trims string by specified bytes at right. Each character is each byte.

---

`fn trim(self, bytes: str): str`\
Trims string by specified bytes at left and right. Each character is each byte.

---

`fn split(self, sub: str, n: int): []str`\
Splits the string into the specified number of parts to the specified substring.\
Returns empty slice if n is equals to zero.\
Returns all parts if n less than zero.

---

`fn replace(self, sub: str, new: str, n: int): str`\
Replaces all substrings matching sub in the string with new.\
Returns same string if n is equals to zero.\
Replaces all matches if n less than zero.

0 comments on commit 44407b6

Please sign in to comment.