EndsWith v0.1.0
Reports whether the string closes with a suffix.
Package: Text
Signature
func EndsWith(self, suffix: String) -> bool;
Parameters
| Name | Type | Description |
|---|---|---|
suffix | String | The bytes to look for at the end. |
Returns
true when the string's last bytes are the bytes of suffix. Every string ends with the empty one, and none ends with a suffix longer than itself.
The comparison is byte for byte and case-sensitive, on the same terms as StartsWith.
Example
import Text::String;
func Main() -> int {
var file = String::From("main.rux");
var ext = String::From(".rux");
file.EndsWith(ext); // true
ext.Free();
file.Free();
return 0;
}
See also
String— the string typeStartsWith— the same test at the other endContains— look for the bytes anywhere