static List<String> findImports(String src) { List<String> imports = new ArrayList<String>(); Pattern pattern = Pattern.compile("^\\s*import\\s+(.*?)\\s*;"); for (String line : toLines(src)) { Matcher matcher = pattern.matcher(line); if (matcher.find()) imports.add(matcher.group(1)); } return imports; }
download show line numbers debug dex old transpilations
Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1002768 |
Snippet name: | findImports - use tok_findImports instead! |
Eternal ID of this version: | #1002768/3 |
Text MD5: | 625a8a51cd73d9d5309cac28be4a5a2b |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2017-09-02 14:06:17 |
Source code size: | 337 bytes / 10 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 683 / 1588 |
Version history: | 2 change(s) |
Referenced in: | #1006654 - Standard functions list 2 (LIVE, continuation of #761) #1010092 - tok_findImports #3000382 - Answer for ferdie (>> t = 1, f = 0) #3000383 - Answer for funkoverflow (>> t=1, f=0 okay) |