[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Any easy way to change a string ? and a bug (or maybe a feature ?)


mid$ works fine for replacing a character in a string
eg.

DIM myString as String ="RETUIOPLJBDNLQSXNKNSXKSXKBSKXKBBB"

mid$(mystring,10,1)="Z"
print mystring
will give

RETUIOPLJZDNLQSXNKNSXKSXKBSKXKBBB


regards, Tim

On 14/10/2024 16:19, Laurent Carlier wrote:
For example:

DIM myString as String ="RETUIOPLJBDNLQSXNKNSXKSXKBSKXKBBB"

I would like to change the 10th character, replacing it with another. I can't
find an easy way to do it.

Is it a bug ?:

DIM myByte as Byte = &hFF&
DIM myString as String = "test string :"

myString &= CStr(myByte)

gives "test string :0\x00FF" instead of "test string :0\xFF", Byte is
converted to a Short value, so unusual. As a workaround, i use chr$(myByte)

Regards,
Laurent Carlier


--
This email has been checked for viruses by AVG antivirus software.
www.avg.com


Follow-Ups:
Re: Any easy way to change a string ? and a bug (or maybe a feature ?)Laurent Carlier <lordheavym@xxxxxxxxx>
References:
Any easy way to change a string ? and a bug (or maybe a feature ?)Laurent Carlier <lordheavym@xxxxxxxxx>