public static String removeSubstring ( String inString , String substring ) { StringBuffer result = new StringBuffer ( ) ; int oldLoc = 0 , loc = 0 ; while ( ( loc = inString . indexOf ( substring , oldLoc ) ) != - 1 ) { result . append ( inString . substring ( oldLoc , loc ) ) ; oldLoc = loc + substring . length ( ) ; } result . append ( inString . substring ( oldLoc ) ) ; return result . toString ( ) ; }
Removes all occurrences of a string from another string .