parent
b3b72cbea2
commit
1070c17f8c
2 changed files with 37 additions and 7 deletions
|
|
@ -633,18 +633,15 @@ value_t report_t::fn_trim(call_scope_t& args)
|
|||
std::strcpy(buf.get(), temp.c_str());
|
||||
|
||||
const char * p = buf.get();
|
||||
while (*p && std::isspace(*p))
|
||||
const char * e = buf.get() + temp.length() - 1;
|
||||
|
||||
while (p <= e && std::isspace(*p))
|
||||
p++;
|
||||
|
||||
const char * e = buf.get() + temp.length() - 1;
|
||||
while (e > p && std::isspace(*e))
|
||||
e--;
|
||||
|
||||
if (e == p) {
|
||||
return string_value(empty_string);
|
||||
}
|
||||
else if (e < p) {
|
||||
assert(false);
|
||||
if (p > e) {
|
||||
return string_value(empty_string);
|
||||
}
|
||||
else {
|
||||
|
|
|
|||
33
test/regress/GH520.test
Normal file
33
test/regress/GH520.test
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
2009-01-01 * Jan 09
|
||||
A 100.00 EUR
|
||||
B
|
||||
|
||||
test reg --format '%(trim(""))\n'
|
||||
|
||||
|
||||
end test
|
||||
|
||||
test reg --format '%(trim("a"))\n'
|
||||
a
|
||||
a
|
||||
end test
|
||||
|
||||
test reg --format '%(trim(" a"))\n'
|
||||
a
|
||||
a
|
||||
end test
|
||||
|
||||
test reg --format '%(trim("a "))\n'
|
||||
a
|
||||
a
|
||||
end test
|
||||
|
||||
test reg --format '%(trim(" a "))\n'
|
||||
a
|
||||
a
|
||||
end test
|
||||
|
||||
test reg --format '%(trim(" aa "))\n'
|
||||
aa
|
||||
aa
|
||||
end test
|
||||
Loading…
Add table
Reference in a new issue