1

Could anyone here tell me how to get rid of the white spaces of the String(a)!!

 String a = "GET /?led=21 HTTP/1.1";
 void setup() {
   Serial.begin(9600);
    Serial.print(a); 
  }
 void loop() {

 }
JAMES
  • 75
  • 2
  • 2
  • 10
  • Arduino uses C https://stackoverflow.com/questions/1726302/removing-spaces-from-a-string-in-c and use Serial.print(RemoveSpaces(a)); – eri0o Sep 27 '15 at 18:31

1 Answers1

2

In Arduino you can replace strings by modifying the existing string like this:

a.replace(" ", "");

Arduino Reference:

The String replace() function allows you to replace all instances of a given character with another character. You can also use replace to replace substrings of a String with a different substring.

Fruchtzwerg
  • 10,999
  • 12
  • 40
  • 49