如何从 Arduino 中的字符串中删除空格?
How to remove white spaces from String in Arduino?
这里有人能告诉我如何去掉 String(a) 的空白!!
String a = "GET /?led=21 HTTP/1.1";
void setup() {
Serial.begin(9600);
Serial.print(a);
}
void loop() {
}
在 Arduino 中,您可以像这样修改现有字符串来替换字符串:
a.replace(" ", "");
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.
这里有人能告诉我如何去掉 String(a) 的空白!!
String a = "GET /?led=21 HTTP/1.1";
void setup() {
Serial.begin(9600);
Serial.print(a);
}
void loop() {
}
在 Arduino 中,您可以像这样修改现有字符串来替换字符串:
a.replace(" ", "");
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.