string_ends/starts_with


string_starts_with(s, prefix)
string_ends_with(s, suffix)
string_ci_starts_with(s, prefix)
string_ci_ends_with(s, suffix)
      

Return true if the string starts with or ends with the prefix/suffix. Otherwise return false.

The string_ci_*** predicates will ignore the case of the strings being compared.

Examples:


string_starts_with("hello, world", "hello")
// true
string_starts_with("hello, world", "Hello")
// false
string_ci_starts_with("hello, world", "Hello")
// true
string_ends_with("hello, world", "ld")
// true
string_ends_with("hello, world", "LD")
// false
string_ci_ends_with("hello, world", "LD")
// true
      

Also see:

string_index_of
string_at


Core Module Index | Contents