question: public static String escapeSom ( String s ) { if ( s == null ) return "" ; int idx = s . indexOf ( '.' ) ; if ( idx < 0 ) return s ; StringBuilder sb = new StringBuilder ( ) ; int last = 0 ; while ( idx >= 0 ) { sb . append ( s . substring ( last , idx ) ) ; sb . append ( '\\' ) ; last = idx ; idx = s . indexOf ( '.' , idx + 1 ) ; } sb . append ( s . substring ( last ) ) ; return sb . toString ( ) ; }
target:  Escapes a SOM string fragment replacing "." with "\.".