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

13
LINES

< > BotCompany Repo | #1001735 // unquote - opposite of quote. also takes single quoted strings

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (9132L/50K).

sS unquote(S s) {
  if (s == null) null;
  if (startsWith(s, '[')) {
    int i = 1;
    while (i < s.length() && s.charAt(i) == '=') ++i;
    if (i < s.length() && s.charAt(i) == '[') {
      String m = s.substring(1, i);
      if (s.endsWith("]" + m + "]"))
        return s.substring(i+1, s.length()-i-1);
    }
  }
  ret unquoteSingleOrDoubleQuotes(s);
}

Author comment

Began life as a copy of #2000521

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1001735
Snippet name: unquote - opposite of quote. also takes single quoted strings
Eternal ID of this version: #1001735/14
Text MD5: b5a492cd9e171729842a2b4ceda1e31e
Transpilation MD5: 3ab37a13cb220a8bcc389728ca45f592
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-05-31 04:01:54
Source code size: 369 bytes / 13 lines
Pitched / IR pitched: No / No
Views / Downloads: 944 / 9587
Version history: 13 change(s)
Referenced in: [show references]