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

52
LINES

< > BotCompany Repo | #1002429 // jfind(s, pattern) - returns C index

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (5586L/31K).

1  
static int jfind(S s, S in) {
2  
  ret jfind(javaTok(s), in);
3  
}
4  
5  
static int jfind(L<S> tok, S in) {
6  
  ret jfind(tok, 1, in);
7  
}
8  
9  
static int jfind(L<S> tok, int startIdx, S in) {
10  
  ret jfind(tok, startIdx, in, (ITokCondition) null);
11  
}
12  
13  
static int jfind(L<S> tok, S in, O condition) {
14  
  ret jfind(tok, 1, in, condition);
15  
}
16  
17  
static int jfind(L<S> tok, int startIndex default 1, S in, IIntPred condition) {
18  
  ret jfind(tok, startIndex, in, tokCondition(condition));
19  
}
20  
21  
static int jfind(L<S> tok, int startIndex default 1, S in, ITokCondition condition) {
22  
  ret jfind(tok, startIndex, in, (O) condition);
23  
}
24  
25  
static int jfind(L<S> tok, int startIdx, S in, O condition) {
26  
  //LS tokin = jfind_preprocess(javaTok(in));
27  
  ret jfind(tok, startIdx, javaTokForJFind_array(in), condition);
28  
}
29  
30  
// assumes you preprocessed tokin
31  
static int jfind(L<S> tok, L<S> tokin) {
32  
  ret jfind(tok, 1, tokin);
33  
}
34  
35  
static int jfind(L<S> tok, int startIdx, L<S> tokin) {
36  
  ret jfind(tok, startIdx, tokin, null);
37  
}
38  
39  
static int jfind(LS tok, int startIdx, S[] tokinC, O condition) {
40  
  ret findCodeTokens(tok, startIdx, false, tokinC, condition);
41  
}
42  
43  
static int jfind(LS tok, int startIdx, L<S> tokin, O condition) {
44  
  ret jfind(tok, startIdx, codeTokensAsStringArray(tokin), condition);
45  
}
46  
47  
static L<S> jfind_preprocess(L<S> tok) {
48  
  for (S type : litlist("quoted", "id", "int"))
49  
    replaceSublist(tok, ll("<", "", type, "", ">"), ll("<" + type + ">"));
50  
  replaceSublist(tok, ll("\\", "", "*"), ll("\\*"));
51  
  ret tok;
52  
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1002429
Snippet name: jfind(s, pattern) - returns C index
Eternal ID of this version: #1002429/15
Text MD5: b8e414fcdfa4bfaa3d0ec3767954eec0
Transpilation MD5: 620cba9a52c983fd496546ea31c3a965
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-02-16 01:31:44
Source code size: 1533 bytes / 52 lines
Pitched / IR pitched: No / No
Views / Downloads: 885 / 1643
Version history: 14 change(s)
Referenced in: [show references]