mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-22 14:59:30 +02:00
LazUtf8: Fix Utf8Insert for StartCharIndex > Utf8Length(s)+1. Reason: consistent with System.Insert().
(cherry picked from commit bad60c010b
)
This commit is contained in:
parent
5c7fcf1fc0
commit
18e40b905b
@ -1201,7 +1201,9 @@ begin
|
||||
StartCharIndex := 1; //Insert() does this correction too
|
||||
StartBytePos:=UTF8CodepointStart(PChar(s),length(s),StartCharIndex-1);
|
||||
if StartBytePos <> nil then
|
||||
Insert(source, s, StartBytePos-PChar(s)+1);
|
||||
Insert(source, s, StartBytePos-PChar(s)+1)
|
||||
else
|
||||
s := s + source; // StartCharIndex > Utf8Length(s) + 1, consistent with System.Insert
|
||||
end;
|
||||
|
||||
function UTF8StringReplace(const S, OldPattern, NewPattern: String;
|
||||
|
Loading…
Reference in New Issue
Block a user