Question whether a string starts with a substring
string:starts_with?(STRING $string, STRING $substring) : BOOL
string:starts_with?('hi friend','hi')
#=> TRUE
string:starts_with?('hello world!','h')
#=> TRUE
string:starts_with?('hello world!','hh')
#=> FALSE
# it is case sensitive
string:starts_with?('hello world!','Hello')
#=> FALSE
# empty substring will return 0
string:starts_with?('hello world!','')
#=> FALSE
# you can check for spaces too
string:starts_with?(' hello world! ',' ')
#=> TRUE
Copyright ©2013-2022 SunSed®. All rights reserved.