subString

I am trying to get the substring method to work. The online documentation claims that is included in the string.h library, but I cannot find any reference to substring in that library. From what I have read online the syntax should be something like

Str2=Str1.subString(2,6) Which ought to return the characters in the 2nd through 6th positions of Str1.

Anybody know how I can fix this? Is there a line or three I can add to the string.h file? Or is there a better way to handle this?

Is this something you’re trying to get working on the Arduino?

  • Brian

I can't say too much for the String.h Library as I've not used it, But the subString() function in the WString.h library works a treat.

http://arduino.cc/en/uploads/Tutorial/String.zip

There is also a great function called charAt() which could also solve your issue, as long as you only need 1 chracter at a time.

Hmmm... is there a write up of all the commands in WString and how to use them?

Indeed there is :) Check here... http://arduino.cc/en/Tutorial/TextString