Throw an exception if the string contains whitespace. Whitespace is not allowed in tagNames and attributes. @param string A string.
(String string)
| 122 | * @param string A string. |
| 123 | */ |
| 124 | public static void noSpace(String string) throws JSONException { |
| 125 | int i, length = string.length(); |
| 126 | if (length == 0) { |
| 127 | throw new JSONException("Empty string."); |
| 128 | } |
| 129 | for (i = 0; i < length; i += 1) { |
| 130 | if (Character.isWhitespace(string.charAt(i))) { |
| 131 | throw new JSONException("'" + string + "' contains a space character."); |
| 132 | } |
| 133 | } |
| 134 | } |
| 135 | |
| 136 | /** |
| 137 | * Scan the content following the named tag, attaching it to the context. |