How to change the textstring
New York, Apple Tree, Banana , Marc Polo
to
New York,Apple Tree,Banana,Marc Polo
I have no idea about how to delete certain blanks which is not between two words.
Any help?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Try
replaceAllwith a regular expression that matches a comma and the surrounding whitespaces and replaces it with just the comma:See it working online: ideone
Note: This won’t remove spaces at the beginning or end of the line. To remove those too you could modify the regular expression, but simpler is to just call
String.Trimafterwards.