i am working in Android application, Using hasPrefix to get a first string value in iphone, but i didn't know how to do this? please help me
In iphone:
Name =@"Thomas edward";
if ([result hasPrefix:Thomas])
{
}
Similarly Android, how to do this?
Thanks in advance
A prefix of a string S is any leading contiguous part of S. A suffix of the string S is any trailing contiguous part of S. For example, "c" and "cod" are prefixes, and "ty" and "ity" are suffixes of the string "codility".
A prefix of a string S is a substring of S that occurs at the beginning of S. A suffix of a string S is a substring that occurs at the end of S. Output the size of the largest such subset. Note that the chosen subset can have a single string also.
C++ std::string Checking if a string is a prefix of anotherstd::string prefix = "foo"; std::string string = "foobar"; bool isPrefix = std::mismatch(prefix. begin(), prefix. end(), string. begin(), string.
A prefix of a string is a substring of that occurs at the beginning of ; likewise, a suffix of a string is a substring that occurs at the end of .
You can use startsWith, or check the index of the string
if(result.startsWith("Thomas"))
{
}
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