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

10
LINES

< > BotCompany Repo | #1036401 // onlyChars

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

Libraryless. Click here for Pure Java version (9902L/55K).

sS onlyChars(S chars, S s) {
  if (empty(chars)) ret "";
  int n = l(s);
  new StringBuilder buf;
  char c;
  for i to n:
    if (contains(chars, c = s.charAt(i)))
      buf.append(c);
  ret str(buf);
}

download  show line numbers  debug dex  old transpilations   

Travelled to 2 computer(s): mowyntqkapby, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1036401
Snippet name: onlyChars
Eternal ID of this version: #1036401/1
Text MD5: c61bf87759ec7eb8bb7c5b24f714a04e
Transpilation MD5: 1f019dc9180bff19de61f8369b530510
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-12-08 01:34:49
Source code size: 211 bytes / 10 lines
Pitched / IR pitched: No / No
Views / Downloads: 48 / 74
Referenced in: [show references]