EndsWith v0.1.0

Source
Reports whether the string closes with a suffix.

Package: Text

Signature

func EndsWith(self, suffix: String) -> bool;

Parameters

NameTypeDescription
suffixStringThe 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