Created
June 23, 2016 08:33
-
-
Save divayprakash/f6b61a5675a25d08c9dd6f68335d9ead to your computer and use it in GitHub Desktop.
Remove whitespace (" ","\t","\v","\f","\r","\n") from String in Arduino
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//REMOVE WHITESPACES FROM STRING IN ARDUINO | |
String message = "\n\tThis is one messed-up string \r\n"; | |
message.trim(); | |
/* | |
trim() | |
Description : Get a version of the String with any leading and trailing whitespace removed. | |
As of 1.0, trim() modifies the string in place rather than returning a new one. | |
Syntax : string.trim() | |
Parameters : string: a variable of type String | |
Returns : none | |
Explanation : trim() is useful for when you know there are extraneous whitespace characters | |
on the beginning or the end of a String and you want to get rid of them. Whitespace refers | |
to characters that take space but aren't seen. It includes the single space (ASCII 32), | |
tab (ASCII 9), vertical tab (ASCII 11), form feed (ASCII 12), carriage return (ASCII 13), | |
or newline (ASCII 10). | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks a lot