forked from solstice/solstice
started writing lexer after making string lib
This commit is contained in:
25
string/docs/check/contains.md
Normal file
25
string/docs/check/contains.md
Normal file
@@ -0,0 +1,25 @@
|
||||
# string_Contains
|
||||
Check if a string has another string in it.
|
||||
|
||||
## Arguments
|
||||
- haystack (string): the string to check against.
|
||||
- needle (string): the string to look for.
|
||||
|
||||
## Returns
|
||||
found (bool): returns `true` if `haystack` has `needle` inside it.
|
||||
|
||||
## Example
|
||||
### Ground
|
||||
```python
|
||||
call !string_Contains "The task was completed successfully." "success" &found
|
||||
println $found # true
|
||||
|
||||
call !string_Contains "The task failed." "success" &found
|
||||
println $found # false
|
||||
```
|
||||
|
||||
### Solstice
|
||||
```c
|
||||
puts string_Contains("The task was completed successfully.", "success") // true
|
||||
puts string_Contains("The task failed.", "success") // false
|
||||
```
|
||||
25
string/docs/check/ends_with.md
Normal file
25
string/docs/check/ends_with.md
Normal file
@@ -0,0 +1,25 @@
|
||||
# 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
|
||||
```
|
||||
25
string/docs/check/starts_with.md
Normal file
25
string/docs/check/starts_with.md
Normal file
@@ -0,0 +1,25 @@
|
||||
# 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
|
||||
```
|
||||
Reference in New Issue
Block a user