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

13
LINES

< > BotCompany Repo | #1009103 // pad - pad (move contents to the right)

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

Transpiled version (83L) is out of date.

static S pad(O s, int l) {
  ret pad(s, l, ' ');
}

static S pad(O s, int l, char c) {
  S _s = str(s);
  if (lengthOfString(_s) >= l) ret _s;
  ret rep(c, l-lengthOfString(_s)) + _s;
}

static S pad(int l, O s) {
  ret pad(s, l);
}

Author comment

Began life as a copy of #1002634

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1009103
Snippet name: pad - pad (move contents to the right)
Eternal ID of this version: #1009103/6
Text MD5: 6078a0ca12273851577af5857f014bd2
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-05-20 22:01:19
Source code size: 240 bytes / 13 lines
Pitched / IR pitched: No / No
Views / Downloads: 553 / 682
Version history: 5 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)
#1014813 - lpad - pad (prepend empty characters)
#1019772 - centerPad - pad (move contents to the middle)