forked from solstice/solstice
25 lines
626 B
Markdown
25 lines
626 B
Markdown
|
|
# string_StartsWith
|
||
|
|
Check if a string is prefixed by another string.
|
||
|
|
|
||
|
|
## Arguments
|
||
|
|
- str (string): the string to check against.
|
||
|
|
- prefix (string): the prefix to check for.
|
||
|
|
|
||
|
|
## Returns
|
||
|
|
hasPrefix (bool): returns `true` if `str` is prefixed by the given `prefix`, otherwise `false`.
|
||
|
|
|
||
|
|
## Example
|
||
|
|
### Ground
|
||
|
|
```python
|
||
|
|
call !string_StartsWith "doc_someFile.txt" "doc_" &hasPrefix
|
||
|
|
println $hasPrefix # true
|
||
|
|
|
||
|
|
call !string_StartsWith "someFile.txt" "doc_" &hasPrefix
|
||
|
|
println $hasPrefix # false
|
||
|
|
```
|
||
|
|
|
||
|
|
### Solstice
|
||
|
|
```c
|
||
|
|
puts string_StartsWith("doc_someFile.txt", "doc_") // true
|
||
|
|
puts string_StartsWith("someFile.txt", "doc_") // false
|
||
|
|
```
|