Skip to content

Commit

Permalink
string/zero left fills
Browse files Browse the repository at this point in the history
  • Loading branch information
aa1024 committed Apr 14, 2018
1 parent 48f3062 commit 75bff63
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions libs/str.q
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/
@desc String helper functions
@functions fc,sf,zf,tu,tl,tstr,cc,ucc,us (snakecase, startcase, traincase )
@functions fc,sfl,zfl,tu,tl,tstr,cc,ucc,us (snakecase, startcase, traincase )
\

\d .str
Expand Down Expand Up @@ -39,18 +39,18 @@ ucc:{ lower trim raze cut[0,where[x=upper[x]] ; x],\:" " }
/@returns String with case swapped
fc:{?[x=lower x;upper x;lower x]}

/@function sf @desc Space fill
/@function sfl @desc Space fill
/ @param int
/ @param String
/@returns String left padded with space
sf:{neg[x]$string y}
sfl:{neg[x]$string y}


/@function sf @desc zero fill
/@function zfl @desc zero fill
/ @param int
/ @param String
/@returns String left padded with zero
zf:{"0"^neg[x]$string y}
zfl:{"0"^neg[x]$string y}

/@function tu @desc to upper
tu:upper
Expand Down

0 comments on commit 75bff63

Please sign in to comment.