1 | sS htmlencode_noQuotes_prettier(String s) { |
2 | if (s == null) ret ""; |
3 | StringBuilder out = new StringBuilder(Math.max(16, s.length())); |
4 | for (int i = 0; i < s.length(); i++) { |
5 | char c = s.charAt(i); |
6 | if (c == '<') out.append("<"); |
7 | else if (c == '>') out.append(">"); |
8 | else if (c > 127 || c == '&') { |
9 | int cp = s.codePointAt(i); |
10 | out.append("&#x"); |
11 | out.append(intToHex_flexLength(cp)); |
12 | out.append(';'); |
13 | i += Character.charCount(cp)-1; |
14 | } else |
15 | out.append(c); |
16 | } |
17 | ret out.toString(); |
18 | } |
19 | |
20 | |
21 | private static final HashMap<String, CharSequence> htmlencode_noQuotes_prettier_lookupMap; |
22 | |
23 | static { |
24 | htmlencode_noQuotes_prettier_lookupMap = new HashMap<String, CharSequence>(); |
25 | for (CharSequence[] seq : htmldecode_escapes()) |
26 | htmlencode_noQuotes_prettier_lookupMap.put(seq[0].toString(), seq[1]); |
27 | } |
Began life as a copy of #1011153
download show line numbers debug dex old transpilations
Travelled to 3 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx
No comments. add comment
Snippet ID: | #1031867 |
Snippet name: | htmlencode_noQuotes_prettier [dev.] |
Eternal ID of this version: | #1031867/1 |
Text MD5: | bad7abea41b3391f4738f4d034b6d52f |
Author: | stefan |
Category: | javax / html |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2021-07-21 15:48:35 |
Source code size: | 878 bytes / 27 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 137 / 162 |
Referenced in: | [show references] |