WString Library

Anyone know where to find the WString library? I want to test a sketch that I found at http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1274596787, but the command "readString.append(c);" "has no memeber".

Forgot to mention I use the Arduino 0021 Software, Duemilanove board, I also have an ethernet shield, the Arduino ETHShiled SD.

Any advice?

Thanks in advance.

The WString library, containing the String class, was replaced for 0021 by an internal class also called String.

You can replace the append() calls with concat().

You should be able to substitute like below in 0021:

replace

readString.append(c);

with

readString += c;

Hey all, thanks for the replies.

The concat() method seems to work, now the next error comes up.
I want to use the sketch here:

But now I'm stuck with an error message telling me "class string has no memeber named "contains". This happens at the line "
if(readString.contains("L=1"))" :stuck_out_tongue:
It looks to me like I require an additional library, like String, but I have Version 0021 that to my knowledge should contain all the string commands.

Any advice on this... can I be more clear in some way?

Use indexOf like below:

 if(readString.indexOf("woohoo") >=0) {
      Serial.println("I found woohoo!"); 
    }

Thank you zoomkat, that worked perfectly! ;D

so what do u do with an error like:

'class String' has no member named 'capacity'

there needs to be a table that shows the alts between wstring and the new core string lib :slight_smile:

so what do u do with an error like:

Two possibilities. One is to edit the library to add a capacity() member, and continue to use that.

The other is to look at how Strings are now implemented, to see that the _capacity (private) field is simply used to determine if a given String object has room to add the new characters. If it doesn't, another (larger) memory allocation is performed, and the existing data copied to the new location, and the old location is freed. Effectively, String objects are now unlimited in size (constrained only by the actual memory available at any given point in time), so the capacity of a string is irrelevant. So, quit asking. There WILL be enough room.

ok that sounds a little copmlicated for a novice like myself.
any chance for an idiots guide? x3 im trying to get a gps sketch to work that i found here but it uses wstring.h and that capacity bit is preventing compile since i have no wstring.h or the rest of that particular lib.
im not really a coder so i cant work out the complex things.

You can get wstring.h below.

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

thanks for that zoom, i added that to arduino 17 ide and the sketch compiled fine, the new ide doesnt like it tho, but thats not a problem