public static void noSpace(String string) throws JSONException {
  int i, length=string.length();
  if (length == 0) {
    throw new JSONException("Empty string.");
  }
  for (i=0; i < length; i+=1) {
    if (Character.isWhitespace(string.charAt(i))) {
      throw new JSONException("'" + string + "' contains a space character.");
    }
  }
}

public static void noSpace ( String string ) throws JSONException { int i , length = string . length ( ) ; if ( length == 0 ) { throw new JSONException ( "Empty string." ) ; } for ( i = 0 ; i < length ; i += 1 ) { if ( Character . isWhitespace ( string . charAt ( i ) ) ) { throw new JSONException ( "'" + string + "' contains a space character." ) ; } } }
throw an exception if the string contains whitespace . whitespace is not allowed in tagnames and attributes .
