jpa/hibernate4_3/src/main/java/org/jboss/as/jpa/hibernate4/management/QueryName.java
private static void subst(final StringBuilder stringBuilder, final String from, final String to) {
        int begin = 0, end = 0;

        while ((end = stringBuilder.indexOf(from, end)) != -1) {
            stringBuilder.delete(end, end + from.length());
            stringBuilder.insert(end, to);

            // update positions
            begin = end + to.length();
            end = begin;
        }
    }
private static void subst(final StringBuilder stringBuilder, final String from, final String to) {
        int begin = 0, end = 0;

        while ((end = stringBuilder.indexOf(from, end)) != -1) {
            stringBuilder.delete(end, end + from.length());
            stringBuilder.insert(end, to);

            // update positions
            begin = end + to.length();
            end = begin;
        }
    }
private static void subst ( final StringBuilder stringBuilder , final String from , final String to ) { int begin = 0 , end = 0 ; while ( ( end = stringBuilder . indexOf ( from , end ) ) != - 1 ) { stringBuilder . delete ( end , end + from . length ( ) ) ; stringBuilder . insert ( end , to ) ; // update positions begin = end + to . length ( ) ; end = begin ; } }
Substitute sub-strings inside of a string.

@param stringBuilder String buffer to use for substitution (buffer is not reset)
@param from String to substitute from
@param to   String to substitute to
Substitute sub - strings inside of a string .