private String replaceSpecialsWithSub ( String inString ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) tc . entry ( cclass , "replaceSpecialsWithSub" , "inString: " + inString ) ; String outString = null ; StringBuffer sb = null ; // First of all look for ampersands int posAmpersand = inString . indexOf ( "@" ) ; if ( posAmpersand >= 0 ) { // Need to do some work, the predicate has an attribute char sb = new StringBuffer ( inString ) ; } // Locate and replace the ampersands while ( posAmpersand >= 0 ) { // Replace the ampersand with "_$AMP$_" sb . replace ( posAmpersand , posAmpersand + 1 , "_$AMP$_" ) ; int start = posAmpersand + 1 ; posAmpersand = sb . indexOf ( "@" , start ) ; } // Now look for slashes int posSlash = inString . indexOf ( "/" ) ; if ( posSlash >= 0 && sb == null ) { // Need to do some work, the predicate has an attribute char sb = new StringBuffer ( inString ) ; } // Locate and replace the slashes while ( posSlash >= 0 ) { // Replace the slash with "_$SL$_" sb . replace ( posSlash , posSlash + 1 , "_$SL$_" ) ; int start = posSlash + 1 ; posSlash = sb . indexOf ( "/" , start ) ; } // Now look for doubledots int posDD = inString . indexOf ( ".." ) ; if ( posDD >= 0 && sb == null ) { // Need to do some work, the predicate has an attribute char sb = new StringBuffer ( inString ) ; } // Locate and replace the doubledots while ( posDD >= 0 ) { // Replace the slash with "_$DD$_" sb . replace ( posDD , posDD + 2 , "_$DD$_" ) ; int start = posDD + 1 ; posDD = sb . indexOf ( ".." , start ) ; } // Now look for singledots int posSD = - 1 ; if ( sb != null ) posSD = sb . indexOf ( "." ) ; else { posSD = inString . indexOf ( "." ) ; if ( posSD >= 0 ) { // Need to do some work, the predicate has an attribute char sb = new StringBuffer ( inString ) ; } } // Locate and replace the singledots while ( posSD >= 0 ) { // Move start position to beyond the current dot int start = posSD + 1 ; // Need to be a bit careful here, we don't want to replace // decimal points if ( start < sb . length ( ) && Character . isDigit ( sb . charAt ( posSD + 1 ) ) ) { // Subsequent char is a digit posSD = - 1 ; } else { // Test previous char if ( posSD > 0 ) { if ( Character . isDigit ( sb . charAt ( posSD - 1 ) ) ) { // Prev char is a digit posSD = - 1 ; } } } // Replace the dot with "_$SD$_" if ( posSD >= 0 ) { sb . replace ( posSD , posSD + 1 , "_$SD$_" ) ; } // Any more dots? posSD = sb . indexOf ( "." , start ) ; } // We've finished if ( sb != null ) { outString = sb . toString ( ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) tc . exit ( this , cclass , "replaceSpecialsWithSub" , outString ) ; return outString ; }
Replace special characters in the string with substitutions .