#1 2024-06-04 14:00:54

tbo
Member
Registered: 2015-04-20
Posts: 353

function TrimLeft(), one character too few

Unit: mormot.core.unicode, commit 7584
Function: function TrimLeft(const S: RawUtf8): RawUtf8;

There should be a +1 at the very end of the last line, otherwise one character too few will be returned.

if i = 1 then
  result := S
else
  FastSetString(result, @PByteArray(S)[i - 1], l - i + 1);

With best regards
Thomas

Offline

#2 2024-06-04 14:32:47

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,686
Website

Re: function TrimLeft(), one character too few

You are right.

Please try
https://github.com/synopse/mORMot2/commit/86d368a4

We added some missing regression tests for this function (and also TrimRight):
https://github.com/synopse/mORMot2/commit/f7d46f16

Offline

Board footer

Powered by FluxBB