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: 839 / 9454
Version history: 13 change(s)
Referenced in: #1001734 - Get Active Swing Component Bot (uses multiport)
#1002427 - Accellerating 629 (SPIKE)
#1003872 - Integrating #759 in One Program
#1003874 - Backup of #759 Before Integration
#1004091 - 759 with new loadClasses (spike)
#1006654 - Standard functions list 2 (LIVE, continuation of #761)
#1006723 - Higher-Level-Transpiled #759 Spike [old]
#1006724 - Backup of #759 before switching to higher-level-translation
#1007595 - "Super-Edgy" JavaX Translator (Extension of #752) [dev., broken]
#1008848 - unquoteCtx
#1010083 - Backup of "Super-Edgy" JavaX Translator (Extension of #7)
#1010084 - Speeding up "Super-Edgy" JavaX Translator (Extension of #7)
#1010087 - Speeding up "Super-Edgy" JavaX Translator (Extension of #7) 2
#1010581 - unquote basic
#1012919 - unquoteMultiline - unquote a multiline string literal
#1012991 - unquote_accurate - not fooled by "\"a\" or \"b\"" (dev.)
#1015252 - unquoteUsingCharArray
#1035508 - unquoteSingleOrDoubleQuotes
#1035509 - unquote_relaxedMLS - allow multi-line strings without proper ending
#3000382 - Answer for ferdie (>> t = 1, f = 0)
#3000383 - Answer for funkoverflow (>> t=1, f=0 okay)