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

4
LINES

< > BotCompany Repo | #1028493 // insertBefore - insert a string before first occurrence of a substring

JavaX fragment (include)

sS insertBefore(S s, S a, S b) {
  int i = indexOf(s, a);
  ret i < 0 ? s : insertAt(s, i, b);
}

Author comment

Began life as a copy of #1007775

download  show line numbers  debug dex  old transpilations   

Travelled to 7 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv

No comments. add comment

Snippet ID: #1028493
Snippet name: insertBefore - insert a string before first occurrence of a substring
Eternal ID of this version: #1028493/2
Text MD5: 15fb165b9dbd0eb9fab89e8679155d09
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-06-22 11:28:50
Source code size: 99 bytes / 4 lines
Pitched / IR pitched: No / No
Views / Downloads: 180 / 216
Version history: 1 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)
#1028563 - insertAfter - insert a string after first occurrence of a substring