What I need to do is find what position a certain string is at, and only keep what’s after that.
Pseudo-code:
string1 = "CDSDC::walrus"
string2 = "::"
string3 = (substr( string1, strfind(string1, string2) + 2 )) // +2 being the len of str2
// at this point I want string3 == "walrus"
strstrdoes what you want. ie locate substrings.For your example,
Or, if you want to split strings into tokens based on delimiters like
::use can usestrtokSplit string into tokens
For your example,
strtokis a tricky function in the sense that it modifies the string you are tokenizing and is also not re-rentrant. Here is a nice article explaining the overall aspects of usingstrtok