You need to sign in to do that
Don't have an account?
Ravindar Admin
How to remove the spaces in before and after the string(Not middle space) dynamically?
I am trying to remove space(dynamically) of input string:
Example: string: ' inputString ', Expecting O/p: 'inputString'
Example like : ' Ravi kumar ' Expecting O/p:'Ravi kumar'
I want to remove the space before or after the string or both before and after, not in the middle.
I tried the following but it is removing all the spaces including middle.
inputString = inputString .replaceAll( '\s+', '');
Example: string: ' inputString ', Expecting O/p: 'inputString'
Example like : ' Ravi kumar ' Expecting O/p:'Ravi kumar'
I want to remove the space before or after the string or both before and after, not in the middle.
I tried the following but it is removing all the spaces including middle.
inputString = inputString .replaceAll( '\s+', '');
All Answers