I have a string
strdata = "<mymarkup><P>Hello world!</P>"
in an array. So for strata[1][1] that contains the above value. How can I detect the < characters with the substring function?
For example:
if (strata[1][1].substring(0,9) = "<mymarkup>") {
// etc...
If you only ever have to check against the same string. E.g. “<mymarkup>” its best to use maerics snippet.
However if you have to check against a lot of different strings it will get cumbersome. Here is a reusable example to check if a string starts with a given prefix.
Functional style:
Object-oriented style