[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 ?)


Le 14/10/2024 à 17:19, Laurent Carlier a écrit :
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.

Mid$(myString, 10, 1) = "X"

But strings are immutable, so you actually create a new string.


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

Yes, but not on the master. Which version of Gambas do you use to get that?

You should get: "test string:255"

--
Benoît Minisini.


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>