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

Method changeToTitleCase

code/src/java/plugin/exporttokens/TextToken.java:210–232  ·  view source on GitHub ↗

Change the supplied string to sentence case. @param value The value to be modified. @return The value in sentence case.

(String value)

Source from the content-addressed store, hash-verified

208 * @return The value in sentence case.
209 */
210 private static String changeToTitleCase(String value)
211 {
212 String temp = value.toLowerCase(Locale.getDefault());
213 char[] chars = temp.toCharArray();
214 StringBuilder res = new StringBuilder(value.length());
215 boolean start = true;
216 for (char c : chars)
217 {
218 boolean whiteSpace = Character.isWhitespace(c);
219
220 if (start && !whiteSpace)
221 {
222 res.append(Character.toUpperCase(c));
223 start = false;
224 }
225 else
226 {
227 start = whiteSpace;
228 res.append(c);
229 }
230 }
231 return res.toString();
232 }
233
234 /**
235 * Build the suffix for the provided number.

Callers 1

getTokenMethod · 0.95

Calls 3

getDefaultMethod · 0.65
toStringMethod · 0.65
appendMethod · 0.45

Tested by

no test coverage detected