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

13
LINES

< > BotCompany Repo | #1000734 // find - find object in collection with matching fields / find in text

JavaX fragment (include)

static String find(String pattern, String text) {
  Matcher matcher = Pattern.compile(pattern).matcher(text);
  if (matcher.find())
    return matcher.group(1);
  return null;
}

static <A> A find(Collection<A> c, O... data) {
  for (A x : c)
    if (checkFields(x, data))
      ret x;
  ret null;
}

Author comment

Began life as a copy of #2000489

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1000734
Snippet name: find - find object in collection with matching fields / find in text
Eternal ID of this version: #1000734/1
Text MD5: bbfcba858ced2ca7e41a485ec46717ae
Author: stefan
Category:
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2016-05-21 02:59:56
Source code size: 311 bytes / 13 lines
Pitched / IR pitched: No / No
Views / Downloads: 699 / 1911
Referenced in: [show references]