Add trimstr/1 function (#3319)
This commit is contained in:
1 parent
de21386681
commit
7d8c096e48
5 files changed
+35
No files matched your search
@@ -76,6 +76,7 @@ def fromdate: fromdateiso8601;
|
||||
def todate: todateiso8601;
|
||||
def ltrimstr($left): if startswith($left) then .[$left | length:] end;
|
||||
def rtrimstr($right): if endswith($right) then .[:$right | -length] end;
|
||||
def trimstr($val): ltrimstr($val) | rtrimstr($val);
|
||||
def match(re; mode): _match_impl(re; mode; false)|.[];
|
||||
def match($val): ($val|type) as $vt | if $vt == "string" then match($val; null)
|
||||
elif $vt == "array" and ($val | length) > 1 then match($val[0]; $val[1])
|
||||
|
||||
Reference in new issue
Block a user