Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

11
LINES

< > BotCompany Repo | #1005235 // escapeMultichars - escape extended Unicode characters to [xchar xxxxxxxx], e.g. for MySQL

JavaX fragment (include)

1  
static S escapeMultichars(S s) {
2  
  if (!hasExtendedUnicodeCharacters(s)) ret s;
3  
  new StringBuilder buf;
4  
  for (int i = 0; i < l(s); i++)
5  
    if (isExtendedUnicodeCharacter(s, i)) {
6  
      buf.append("[xchar " + intToHex(s.codePointAt(i)) + "]");
7  
      ++i;
8  
    } else
9  
      buf.append(s.charAt(i));
10  
  ret str(buf);
11  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ddnzoavkxhuk, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1005235
Snippet name: escapeMultichars - escape extended Unicode characters to [xchar xxxxxxxx], e.g. for MySQL
Eternal ID of this version: #1005235/2
Text MD5: e8767608d329dbd467eb31ce14a6bd71
Author: stefan
Category: javax / unicode
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-03-10 14:20:48
Source code size: 326 bytes / 11 lines
Pitched / IR pitched: No / No
Views / Downloads: 727 / 998
Version history: 1 change(s)
Referenced in: [show references]