Currently I am trying to remove dash in my string array. The code that I tried below didn't work.
splitTimeStamp[0].replaceAll("[\\s\\-()]", "");
System.out.println(splitTimeStamp[0]);
Got the replaceAll code from another stackoverflow page.
Thanks in advance!
Answer
The method returns a new String
. The original one isn't changed.
You need to save the result like this
splitTimeStamp[0] = splitTimeStamp[0].replaceAll("[\\s\\-()]", "");
System.out.println(splitTimeStamp[0]);
No comments:
Post a Comment