mirror of
https://github.com/wader/fq.git
synced 2024-12-25 22:34:14 +03:00
Merge pull request #668 from wader/trim-multiline
interp: trim: Add multi-line support
This commit is contained in:
commit
070d5f43ab
@ -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