I have been trying to construct a while loop for looping through a string when it contains a \'pattern\' i\'m looking for. The string is a local variable, declared just above th
String is immutable in java
modifiedOnlineList = modifiedOnlineList.substring(tempFirstOccurence + 2);
You have to receive the new String
Object returned by substring
method.
modifiedOnlineList.substring(tempFirstOccurence + 2);
System.out.println(modifiedOnlineList); // still old value
when you receive that
modifiedOnlineList = modifiedOnlineList.substring(tempFirstOccurence + 2);
System.out.println(modifiedOnlineList); // now re assigned to substring value