mirror of
https://github.com/wader/fq.git
synced 2024-10-26 11:49:54 +03:00
interp: trim: Add multi-line support
This commit is contained in:
parent
f254b16cfc
commit
d5ae11659f
@ -5,7 +5,7 @@ include "decode";
|
||||
|
||||
def intdiv(a; b): _intdiv(a; b);
|
||||
|
||||
def trim: capture("^\\s*(?<str>.*?)\\s*$"; "").str;
|
||||
def trim: capture("^\\s*(?<str>.*?)\\s*$"; "m").str;
|
||||
|
||||
# does +1 and [:1] as " "*0 is null
|
||||
def rpad($s; $w): . + ($s * ($w+1-length))[1:];
|
||||
|
@ -71,3 +71,9 @@ streaks_by(.a)
|
||||
["12"]
|
||||
["12","34"]
|
||||
["123","4"]
|
||||
|
||||
.[] | trim
|
||||
["a", " abc ", "\n\t a\nb\n"]
|
||||
"a"
|
||||
"abc"
|
||||
"a\nb"
|
||||
|
Loading…
Reference in New Issue
Block a user