Hi all,
Let's ask and answer questions about string manipulation in eC/EcereSDK here.
-redj
String Manipulation
Re: String Manipulation
What's the best method to get rid of extra spaces in a string?
Please show method(s) to remove double, triple and so on space by a single space.
Including solution(s) that handle all space characters including tab or alternatively only actual spaces.
-redj
Please show method(s) to remove double, triple and so on space by a single space.
Including solution(s) that handle all space characters including tab or alternatively only actual spaces.
-redj
Re: String Manipulation
here's something:
sdk/extras/stringTools.ec
that works rather nicely:
also:
list of new functions:
Enjoy!
-redj
sdk/extras/stringTools.ec
that works rather nicely:
Code: Select all
char * s = SingleFuncCharsCopy(" my string ", isspace, both, ' ');
Code: Select all
char * s = SingleCharsCopy(" my string ", " \t\n\r!@#$%^&*()-=+{}[]|", both, ' ');
Code: Select all
void SingleChars(char * string, char * output, char * chars, Trim trim, char alt)
char * SingleCharsCopy(char * string, char * chars, Trim trim, char alt)
void SingleFuncChars(char * string, char * output, int (*CharTest)(char), Trim trim, char alt)
char * SingleFuncCharsCopy(char * string, int (*CharTest)(char), Trim trim, char alt)
-redj