I ran the program shown in the picture and tried it with 'hello my friend' as the string and 'o' as the delimiter and it gives: But is a delimiter that whole "april 10" or just an "a" at the beginning? How would this help if I do not know what month it is (april, may, june, etc) or does it basically just work as a "find" command? In MATLAB I would normally probably write the token as (\w*\s\d*) in order to locate the date (april 10) in the text since I do not know what date it would be (what letter it starts with or the digits after it). You see I am confused as to what a "delimiter" is exactly in context. I imagine the token is "april 10" but the starting delimiter would be "a" and the ending delimiter would be a digit? So for example, if I wanted to find the section of a text which gave me a certain date and the whole text was: "I like the date april 10 because it is close to May Day". It also allows for two possible output argument lists"ġ) Is a delimiter specified at the beginning or end of a token? Given one input, the function assumes a default delimiter of whitespace given two, it lets you specify another delimiter if desired. A token is a set of characters delimited by whitespace or some other character. "Here’s a more advanced example that finds the first token in a character string.
#String split for matlab 2009 code#
Based on MATLAB's code for strtok (see end):