How can I check if a text “begin with” substring in Actionscript 3 ??
Thanks a lot for help.
There is an indexOf method: documentation.
It returns the first index of where the given string appears in the string that is searched. If this is not equal to 0
, it doesn't start with the string. You can make the following function yourself:
function startsWith(haystack:String, needle:String):boolean {
return haystack.indexOf(needle) == 0;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With