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

25
LINES

< > BotCompany Repo | #1018364 // bb_parseList

JavaX fragment (include)

1  
static BBRule bb_parseList(S listName) {
2  
  ret bb_parseList(listName, mL_raw(listName));
3  
}
4  
5  
static BBRule bb_parseList(S listName, S text) {
6  
  LS parts = splitAtEmptyLines(text);
7  
  if (empty(parts)) null;
8  
  new BBRule r;
9  
  r.listName = listName;
10  
  new Matches m;
11  
  for (S s : parts) {
12  
    s = trim(s);
13  
    if (swic_trim(s, "Subject:", m))
14  
      r.subject = dropNewLines($1);
15  
    else if (swic_trim(s, "Expression:", m))
16  
      r.expression = joinNempties(" || ", r.expression, dropNewLines($1));
17  
    else if (swic_trim(s, "Description:", m))
18  
      r.description = dropNewLines($1);
19  
    else if (swicOneOf_trim(s, m, "Antwortmodus:", "Selector:"))
20  
      r.answerMode = dropNewLines($1);
21  
    else
22  
      r.answers.add(s);
23  
  }
24  
  ret r;
25  
}

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: 325 / 393
Version history: 9 change(s)
Referenced in: [show references]