fi
}
-STRING='
- s;\\;\\\\;g;
- s;\n;\\n;g;
- s;\t;\\t;g;
- s;\r;\\r;g;
- s;\+;\\+;g;
- s; ;+;g;
-'
-
-STRING_OLD(){
- { [ $# -eq 0 ] && cat || printf %s "$*"; } \
- | sed -E ':X; $!{N;bX;}'"$STRING"
-}
-
+# STRING='
+# s;\\;\\\\;g; s;\t;\\t;g;
+# s;\n;\\n;g; s;\r;\\r;g;
+# s;\+;\\+;g; s; ;+;g;
+# '
STRING(){
local in out=''
[ $# -gt 0 ] && in="$*" || in="$(cat)"
printf '%s' "$out"
}
-
UNSTRING='
:UNSTRING_X
s;((^|[^\\])(\\\\)*)\\n;\1\n;g;
s;((^|[^\\])(\\\\)*)\\\+;\1+;g;
s;\\\\;\\;g;
'
-UNSTRING_OLD(){
- { [ $# -eq 0 ] && cat || printf %s "$*"; } \
- | sed -E "$UNSTRING"
-}
UNSTRING(){
local in out=''
[ $# -gt 0 ] && in="$*" || in="$(cat)"