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

15
LINES

< > BotCompany Repo | #1003800 - endsWith

JavaX fragment (include)

1  
static bool endsWith(S a, S b) {
2  
  ret a != null && a.endsWith(b);
3  
}
4  
5  
static bool endsWith(S a, char c) {
6  
  ret nempty(a) && lastChar(a) == c;
7  
}
8  
9  
ifclass Matches
10  
  static bool endsWith(S a, S b, Matches m) {
11  
    if (!endsWith(a, b)) false;
12  
    m.m = new S[] {dropLast(l(b), a)};
13  
    true;
14  
  }
15  
endif

download  show line numbers  debug dex   

Travelled to 11 computer(s): aoiabmzegqzx, cbybwowwnfue, cfunsshuasjs, ddnzoavkxhuk, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, tslmcundralx, tvejysmllsmz

No comments. add comment

Snippet ID: #1003800
Snippet name: endsWith
Eternal ID of this version: #1003800/4
Text MD5: 1703271ef2b9bffcc505645fe6d4d289
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-06-13 03:46:34
Source code size: 314 bytes / 15 lines
Pitched / IR pitched: No / No
Views / Downloads: 356 / 402
Version history: 3 change(s)
Referenced in: [show references]

Formerly at http://tinybrain.de/1003800 & http://1003800.tinybrain.de