EndsWith
Reports whether the string closes with a suffix.
Module: Text
Signature
rux
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
rux
import Text::String;
var file = String::From("main.rux");
var ext = String::From(".rux");
file.EndsWith(ext); // true
ext.Free();
file.Free();See also
String— the string typeStartsWith— the same test at the other endContains— look for the bytes anywhere