Strings

BlitzMax Forums/BlitzMax Beginners Area/Strings

If you like your 20 year old C++ like hacking on stuff that much, why don't you do us all a favor and just use it?
Its quite annoying ...
You come up each time again with stuff that works like this in C++ and expect that BM behaves as well like an over 20 year old programming language.

Compare to java and C# and you will see that string there behave the same.

If you want to have a string that can be modified insitu, you have to use StringBuffers in Java, so create yourself something similar or ask mark, but don't trash Strings and their functionality just because you lack some knowledge of how "modern" programming languages work and must work.
What you try to achieve with this access is something BM just not allows: Pointer hick-hack! It worked till 1.12 or so, but by then, pointers were removed from BM internal usage due to problems (BM is managed, pointers arent -> serious problem)
Agree with it and life with it.


It might sound harsh, but thats how modern languages work.
But BM is able to interface with stoneage languages, so why not use this fact.

here the way to do it the stone age way:

Strict
Local test:String
test = "Blah"
Local t1:Byte Ptr = test.tocstring()
t1[0] = Asc("b")
test = String.fromCString(t1)
Print test


edit:
As you see, this way would even allow partial replacement through the memcpy commands etc, just in case there are questions on how to do it with more than 1 character :)