MCPcopy Create free account
hub / github.com/VolmitSoftware/Adapt / noSpace

Method noSpace

src/main/java/com/volmit/adapt/util/XML.java:124–134  ·  view source on GitHub ↗

Throw an exception if the string contains whitespace. Whitespace is not allowed in tagNames and attributes. @param string A string.

(String string)

Source from the content-addressed store, hash-verified

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.

Callers 1

toStringMethod · 0.95

Calls 1

lengthMethod · 0.45

Tested by

no test coverage detected