MCPcopy Create free account
hub / github.com/M66B/FairEmail / getPrintableString

Method getPrintableString

app/src/main/java/eu/faircode/email/Helper.java:2394–2416  ·  view source on GitHub ↗
(String value, boolean debug)

Source from the content-addressed store, hash-verified

2392 // https://issuetracker.google.com/issues/37054851
2393
2394 static String getPrintableString(String value, boolean debug) {
2395 if (debug) {
2396 if (value == null)
2397 return "<null>";
2398 if (TextUtils.isEmpty(value))
2399 return "<empty>";
2400 } else
2401 return value;
2402 StringBuilder result = new StringBuilder();
2403 for (int i = 0; i < value.length(); ) {
2404 int codepoint = value.codePointAt(i);
2405 if (debug && codepoint == 10)
2406 result.append('|');
2407 else if (debug && codepoint == 32)
2408 result.append('_');
2409 else if (!Helper.isPrintableChar(codepoint) || codepoint == 160)
2410 result.append('{').append(Integer.toHexString(codepoint)).append('}');
2411 else
2412 result.append(Character.toChars(codepoint));
2413 i += Character.charCount(codepoint);
2414 }
2415 return result.toString();
2416 }
2417
2418 static DateFormat getTimeInstance(Context context) {
2419 return getTimeInstance(context, SimpleDateFormat.MEDIUM);

Callers 5

normalizeNamespacesMethod · 0.95
getMethod · 0.95
onExecuteMethod · 0.95
limitReferencesMethod · 0.95
getExtrasMethod · 0.95

Calls 5

isPrintableCharMethod · 0.95
isEmptyMethod · 0.45
lengthMethod · 0.45
appendMethod · 0.45
toStringMethod · 0.45

Tested by

no test coverage detected