This example introduces two new methods |
actualstring.IndexOf(lookfor); // where lookfor can be any string or property holding a string |
This returns index in actualstring where character in actualstring starts a substring that exactly matches lookfor |
"http://www.npac.syr.edu".IndexOf("www"); // returns 7 |
actualstring.IndexOf(lookfor, searchfrom); // searchfrom is the index where search starts -- in example where we scan for commas, searchfrom is set to be one more than location where last comma found |
IndexOf and lastIndexOf return -1 if requested string cannot be found |
actualstring.lastIndexOf(lookfor, lastsearchfrom); // is just like IndexOf but starts from the end not the beginning of the string |
default value of lastsearchfrom is actualstring.length-1 |