forked from solstice/solstice
25 lines
596 B
Markdown
25 lines
596 B
Markdown
|
|
# string_EndsWith
|
||
|
|
Check if a string has another string as a suffix.
|
||
|
|
|
||
|
|
## Arguments
|
||
|
|
- str (string): the string to check against.
|
||
|
|
- suffix (string): the suffix to check for.
|
||
|
|
|
||
|
|
## Returns
|
||
|
|
hasSuffix (bool): returns `true` if `str` has the given `suffix` as a suffix, otherwise `false`.
|
||
|
|
|
||
|
|
## Example
|
||
|
|
### Ground
|
||
|
|
```python
|
||
|
|
call !string_EndsWith "file.txt" ".txt" &hasSuffix
|
||
|
|
println $hasSuffix # true
|
||
|
|
|
||
|
|
call !string_EndsWith "file.grnd" ".txt" &hasSuffix
|
||
|
|
println $hasSuffix # false
|
||
|
|
```
|
||
|
|
|
||
|
|
### Solstice
|
||
|
|
```c
|
||
|
|
puts string_EndsWith("file.txt", ".txt") // true
|
||
|
|
puts string_EndsWith("file.grnd", ".txt") // false
|
||
|
|
```
|