journal/tool/lib/stringLib.jq

10 lines
544 B
Plaintext
Raw Normal View History

2024-11-09 00:49:08 +00:00
def titleCase:
[splits("\\b") | select(length>0)]
| map((.[:1]|ascii_upcase) + (.[1:] |ascii_downcase))
| join("");
def lpad(string;len;fill):
if len == 0 then string else (fill * len)[0:len] + string end;
def rpad(string;len;fill):
if len == 0 then string else string + (fill * len)[0:len] end;