ends_with
Builtin index · Collections & strings
result = ends_with(s, suffix)
Input: s, suffix · Output: result
What it is
s and suffix are Strs.
Overloads
One call shape — this function is not overloaded.
| Code | Input | Output | Description |
result = ends_with(s, suffix) | s Strnot documented yetsuffix Strnot documented yet | result bool | Returns a bool: true if s ends with suffix. |
Examples
From the documentation, and run by the build -- the output and the figure below are what the engine actually produced. Simplest first.
path = "report_final_v2.txt"
print(ends_with(path, ".txt")) # true
print(index_of(path, "_")) # 6
print(last_index_of(path, "_")) # 12
print(insert("helloworld", 5, ", ")) # "hello, world"
print(remove("hello, world", ", ")) # "helloworld"
line = "key: value"
print(after(line, ": ")) # "value"
print(before(line, ": ")) # "key"
full = "a/b/c.txt"
print(after_last(full, "/")) # "c.txt"
print(before_last(full, "/")) # "a/b"
output
true 6 12 hello, world helloworld value key c.txt a/b
from collections-strings