Delphi Pages Forums

Delphi Pages Forums (http://www.delphipages.com/forum/index.php)
-   General (http://www.delphipages.com/forum/forumdisplay.php?f=2)
-   -   String character change. (no replacestring) (http://www.delphipages.com/forum/showthread.php?t=217784)

FreakaZoid2 07-20-2018 05:16 PM

String character change. (no replacestring)
 
i have a stringlist of lines of text.
i want to change the 43rd character in the string.
i have it working this way BUT wanted to know if there is a better function/option.
.....
astring := _strlist[i];
astring[43] := '3';
_strlist[i] := astring;
......
i tried to cast but get compile error left side cannot be assigned to
......
string(_strlist[i])[43] := '3';
......
just wanting to learn something new if possible...

Marsheng 07-21-2018 09:37 AM

_strlist[i]:=copy(_strlist[i],1,43)+'3'+copy(_strlist[i],45,length(_strlist[i])

Not tested but should be correct.


All times are GMT. The time now is 09:22 AM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2019, vBulletin Solutions, Inc.