I have looked at this and can't see the wood for the trees!
I am use in Arduino 1.03 and in my program I use
string.replace("T", "");
and it does delete the character, however I need to do this for a few fixed characters and therefore trying to place it in a function , the Serial.print does correctly print the characters to be replaced and is there as a debug statement.
//declared at the top of program
const char stripChars [6] PROGMEM = "{}DIT";
//Sanity call to function
String striped = stripMyStr("{A}AIATADA");
//function
String stripMyStr(String strToStrip){
for (int i = 0; i < 5; ++i)
{ //tried uint8_t myChar
myChar = pgm_read_byte (stripChars + i);
Serial.print(myChar);
strToStrip.replace(myChar, "");
}
return strToStrip;
}
Error message from Arduino IDE is :-
error: call of overloaded 'replace(uint8_t&, const char [1])' is ambiguous
Any help much appreciated, explanation as to where I am going wrong(plain English very, very welcome.
Though I do agree and as such the program does work without this function, but for once in my life I have time to solve the problem the way I wish, not just take an easy way, or put it another way, retired and being pedantic
There are some bugs in the String class, that's why I recommend not using it.
Anyway, your problem is that "myChar" is (most likely) declared as "char myChar", and that replace function expect a String, so you have to convert. I'm not sure, but try:
I don't think it is a particularly good idea to call things in the constructor, particularly if you are doing serial prints, as you were. The constructor is called before the system is fully initialized.
I've only used the PROGMEN method a few times, so I am not an expert, but when I
was using it the other day and looked up the example, they were telling me to use
prog_char message[] PROGMEM = "this is the message" ;
So if you are using regular 'char' instead of 'prog_char', that might be your problem.