[r916]: / branches / develop / mqttsparkplug / mqttsparkplug / Sparkplug™ MQTT edge and host / Function Blocks / FB_WStringBuilder / FB_WStringBuilder / InsertAt / svnobj  Maximize  Restore  History

Download this file

16 lines (15 with data), 5.0 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
// If there are too many characters to fit in the buffer, 
(*----------------------------------------------------------------------------------*)
CurrentLength    := THIS^.Len();
AdditionalLength := Stu.StrLenW(pwTempStr1);
TotalLength      := CurrentLength + AdditionalLength;
(* Loop: Move the rightmost to make room *)
FOR i := MIN(TotalLength,GC_sparkplug.supported_string_lengths)
     TO (Position + AdditionalLength) BY -1 DO
	pwTempDestStr[i -1] := pwTempDestStr[i -1 - AdditionalLength];
END_FOR
(* Loop: Insert additional Text *)
FOR i := 0 
	pwTempDestStr[MIN(TotalLength,GC_sparkplug.supported_string_lengths)+1]:= 0;
(* Set: Return value *)
	InsertAt := THIS^;