MCPcopy Create free account
hub / github.com/codenameone/CodenameOne / writeString

Method writeString

scripts/common/java/PostPrComment.java:638–660  ·  view source on GitHub ↗
(StringBuilder sb, String value)

Source from the content-addressed store, hash-verified

636 }
637
638 private static void writeString(StringBuilder sb, String value) {
639 sb.append('"');
640 for (int i = 0; i < value.length(); i++) {
641 char ch = value.charAt(i);
642 switch (ch) {
643 case '"' -> sb.append("\\\"");
644 case '\\' -> sb.append("\\\\");
645 case '\b' -> sb.append("\\b");
646 case '\f' -> sb.append("\\f");
647 case '\n' -> sb.append("\\n");
648 case '\r' -> sb.append("\\r");
649 case '\t' -> sb.append("\\t");
650 default -> {
651 if (ch < 0x20) {
652 sb.append(String.format("\\u%04x", (int) ch));
653 } else {
654 sb.append(ch);
655 }
656 }
657 }
658 }
659 sb.append('"');
660 }
661
662 private static final class Parser {
663 private final String text;

Callers 6

writeValueMethod · 0.95
invoke3Method · 0.45
mainMethod · 0.45
mainMethod · 0.45
patchRootBuildGradleMethod · 0.45
patchAppBuildGradleMethod · 0.45

Calls 4

formatMethod · 0.95
appendMethod · 0.65
lengthMethod · 0.65
charAtMethod · 0.65

Tested by

no test coverage detected