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)

static S escapeMultichars(S s) {
  if (!hasExtendedUnicodeCharacters(s)) ret s;
  new StringBuilder buf;
  for (int i = 0; i < l(s); i++)
    if (isExtendedUnicodeCharacter(s, i)) {
      buf.append("[xchar " + intToHex(s.codePointAt(i)) + "]");
      ++i;
    } else
      buf.append(s.charAt(i));
  ret str(buf);
}

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: 606 / 886
Version history: 1 change(s)
Referenced in: [show references]