3 ms·
In a POSIX shell, I would do it like this: trim_string () ( x=${1%[:space:]} return ${x#[:space:]} ) Note the use of a subshell ( instead of command g
by chasil 5y ago
In a POSIX shell, I would do it like this:
trim_string () (
x=${1%[:space:]}
return ${x#[:space:]}
)
Note the use of a subshell ( instead of command grouping { because POSIX shells do not have local function variables.
At least, I think that would work.
On Windows, forking is expensive, so I wouldn't do it this way.