private String escape ( String rawActivityName ) { boolean lastIsUnderScore = false ; StringBuffer sb = new StringBuffer ( ) ; for ( int i = 0 ; i < rawActivityName . length ( ) ; i ++ ) { char ch = rawActivityName . charAt ( i ) ; if ( Character . isLetterOrDigit ( ch ) ) { sb . append ( ch ) ; lastIsUnderScore = false ; } else if ( ! lastIsUnderScore ) { sb . append ( UNDERSCORE ) ; lastIsUnderScore = true ; } } return sb . toString ( ) ; }
Replaces space characters in the activity name with underscores .