MCPcopy Create free account
hub / github.com/PCGen/pcgen / encode

Method encode

code/src/java/pcgen/io/EntityEncoder.java:144–157  ·  view source on GitHub ↗

encode characters. {@literal "\n" -> "&nl;" "\r" -> "&cr;" "\f" -> "&lf;" ":" -> ":" "|" -> "&pipe;" "[" -> "&lbracket;" "]" -> "&rbracket;" "&" -> "&" } author: Thomas Behr 09-09-02 @param s the String to encode @return the encoded String

(String s)

Source from the content-addressed store, hash-verified

142 * @return the encoded String
143 */
144 public static String encode(String s)
145 {
146 final StringBuilder buffer = new StringBuilder();
147 if (s != null)
148 {
149 final StringTokenizer tokens = new StringTokenizer(s, ENCODE, true);
150
151 while (tokens.hasMoreTokens())
152 {
153 buffer.append(ENTITIES.get(tokens.nextToken()));
154 }
155 }
156 return buffer.toString();
157 }
158
159 /**
160 * Encode the characters.

Callers 15

unparseMethod · 0.95
getPCCTextMethod · 0.95
appendBirthdayLineMethod · 0.95
appendBirthplaceLineMethod · 0.95
appendCatchPhraseLineMethod · 0.95

Calls 5

hasMoreTokensMethod · 0.80
nextTokenMethod · 0.80
getMethod · 0.65
toStringMethod · 0.65
appendMethod · 0.45

Tested by

no test coverage detected