Hi.
Consider these values "apple fruit, grapes fruit, onion veg , meat non-veg". Now how can i trim just the spaces or tabs before and after the comma. I need the spaces in between the values. I have tried using the split method and then trim the spaces to do this i have to split each and every value is there any other way.
Do you need an array, or just a string with the spaces removed?
Either way, the regular expression to use is ",\\s+" - a comma followed by one or more occurrences of whitespace. Splitting would be done as follows:
Replacing:
This thread is more suitable for the intermediate forum, moving there.