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

19
LINES

< > BotCompany Repo | #1002737 // Test = splitting

JavaX source code [tags: use-pretranspiled] - run with: x30.jar

Libraryless. Click here for Pure Java version (637L/5K/15K).

!752

p {
  S rule = "= = idword";
  L<S> lr = splitAtJavaToken(rule, "=");
  print(structure(lr));
  S l, r;
  if (l(lr) == 1) {
    l = "";
    r = lr.get(0);
  } else if (l(lr) >= 2) {
    l = join(" = ", lr.subList(0, l(lr)-1));
    r = last(lr);
  } else {
    print("Weird rule: " + rule);
    ret;
  }
  print(quote(l) + " = " + quote(r));
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1002737
Snippet name: Test = splitting
Eternal ID of this version: #1002737/1
Text MD5: 68d915aa163cc3ca96adf648c65e65ba
Transpilation MD5: d8b52a1aea4a64b2d97533dd2879e36b
Author: stefan
Category: snl
Type: JavaX source code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2016-02-18 21:37:27
Source code size: 366 bytes / 19 lines
Pitched / IR pitched: No / No
Views / Downloads: 599 / 641
Referenced in: #3000382 - Answer for ferdie (>> t = 1, f = 0)
#3000383 - Answer for funkoverflow (>> t=1, f=0 okay)