Updated smnp.text (markdown)
49
smnp.text.md
49
smnp.text.md
@@ -1,39 +1,66 @@
|
||||
# Methods
|
||||
## `string.find(char: string)`
|
||||
## string.find
|
||||
```
|
||||
string.find(char: string)
|
||||
```
|
||||
Returns index of given character in string and -1 if value not exist.
|
||||
|
||||
## `string.isEmpty()`
|
||||
## string.isEmpty
|
||||
```
|
||||
string.isEmpty()
|
||||
```
|
||||
Checks if length of string is equal to 0.
|
||||
|
||||
## `string.isNotEmpty()`
|
||||
## string.isNotEmpty
|
||||
```
|
||||
string.isNotEmpty()
|
||||
```
|
||||
Checks if length of string is greater than 0.
|
||||
|
||||
## `string.toInt()`
|
||||
## string.toInt
|
||||
```
|
||||
string.toInt()
|
||||
```
|
||||
Tries to convert `string` to `int`. If the text actually represents an `int`, it returns it as of `int` type. It returns itself (as a `string`) otherwise.
|
||||
|
||||
## `string.substring(startIndex: int, endIndex: int)`
|
||||
## string.substring
|
||||
```
|
||||
string.substring(startIndex: int, endIndex: int)
|
||||
```
|
||||
Returns a substring.
|
||||
|
||||
### Example
|
||||
#### Example
|
||||
```
|
||||
println("Hello world".substring(1, 5)); # ello
|
||||
```
|
||||
|
||||
## `string.split(delimiter: string)`
|
||||
## string.split
|
||||
```
|
||||
string.split(delimiter: string)
|
||||
```
|
||||
Splits the string with given delimiter to list of strings and returns it.
|
||||
|
||||
### Example
|
||||
#### Example
|
||||
```
|
||||
str = "this:is:some:text";
|
||||
|
||||
println(str.split(":")); # [this, is, some, text]
|
||||
```
|
||||
|
||||
## `string.toFloat()`
|
||||
## string.toFloat
|
||||
```
|
||||
string.toFloat()
|
||||
```
|
||||
Tries to convert `string` to `float`. If the text actually represents a `float`, it returns it as of `float` type. It returns itself (as a `string`) otherwise.
|
||||
|
||||
## `string.toBool()`
|
||||
## string.toBool
|
||||
```
|
||||
string.toBool()
|
||||
```
|
||||
Tries to convert `string` to `bool`. If the text actually is equal to `"true"` or `"false"`, it returns it as of `bool` type. It returns itself (as a `string`) otherwise.
|
||||
|
||||
## `string.toNote()`
|
||||
## string.toNote
|
||||
```
|
||||
string.toNote()
|
||||
```
|
||||
Tries to convert `string` to `note`. If the text actually represents a `note`, it returns it as of `note` type. It returns itself (as a `string`) otherwise.
|
||||
Reference in New Issue
Block a user