Updated smnp.text (markdown)

Bartłomiej Przemysław Pluta
2020-04-02 09:19:13 +02:00
parent b5db8c09c5
commit cfbe2b91ef

@@ -1,66 +1,66 @@
# Methods
## string.find
```
```php
string.find(char: string)
```
Returns index of given character in string and -1 if value not exist.
## string.isEmpty
```
```php
string.isEmpty()
```
Checks if length of string is equal to 0.
## string.isNotEmpty
```
```php
string.isNotEmpty()
```
Checks if length of string is greater than 0.
## string.toInt
```
```php
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
```
```php
string.substring(startIndex: int, endIndex: int)
```
Returns a substring.
#### Example
```
```php
println("Hello world".substring(1, 5)); # ello
```
## string.split
```
```php
string.split(delimiter: string)
```
Splits the string with given delimiter to list of strings and returns it.
#### Example
```
```php
str = "this:is:some:text";
println(str.split(":")); # [this, is, some, text]
```
## string.toFloat
```
```php
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
```
```php
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
```
```php
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.