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

25
LINES

< > BotCompany Repo | #1018364 // bb_parseList

JavaX fragment (include)

static BBRule bb_parseList(S listName) {
  ret bb_parseList(listName, mL_raw(listName));
}

static BBRule bb_parseList(S listName, S text) {
  LS parts = splitAtEmptyLines(text);
  if (empty(parts)) null;
  new BBRule r;
  r.listName = listName;
  new Matches m;
  for (S s : parts) {
    s = trim(s);
    if (swic_trim(s, "Subject:", m))
      r.subject = dropNewLines($1);
    else if (swic_trim(s, "Expression:", m))
      r.expression = joinNempties(" || ", r.expression, dropNewLines($1));
    else if (swic_trim(s, "Description:", m))
      r.description = dropNewLines($1);
    else if (swicOneOf_trim(s, m, "Antwortmodus:", "Selector:"))
      r.answerMode = dropNewLines($1);
    else
      r.answers.add(s);
  }
  ret r;
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1018364
Snippet name: bb_parseList
Eternal ID of this version: #1018364/10
Text MD5: 123f44c98fc7b9952c0be56af7f9f577
Author: stefan
Category: javax / a.i.
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-10-01 16:54:18
Source code size: 756 bytes / 25 lines
Pitched / IR pitched: No / No
Views / Downloads: 323 / 391
Version history: 9 change(s)
Referenced in: [show references]