Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
@AppleLover Well damn, I never thought it was like that in Python. How the heck did I miss that? I programmed it exclusively for 5+ years. Well fuck python too! lol
-
stop68045y@Demolishun strings were always immutable, but it has a ton of methods that return a manipulated string.
-
Voxera113975y@Demolishun Almost all modern languages use immutable strings for security and performance.
For max performance there are in dome languages ways around this.
C# has unsafe mode where you can mutate them, and in the latest version span<T> which is a form of safer mutable memory.
But only old langs like c++ and old basic uses mutable strings.
And in js there actually are a few new memory types that might be more like what you wanted, but its not certain that it is faster unless we are talking about strings of thousands or hundreds of thousand chars, in which case switching to c++ might still be a viable option :) -
Just checked to make sure std::string will let me edit by indices. Yes, yes it will.
Related Rants
So I was playing around with JS inside of QML (Qt). I wanted to turn a number into a string and then modify individual chars based on certain criteria. Then I would convert back to a number. Should be simple right? Well JS would not let me write to the indexed element of the string. What the actual fuck? I need to drop to C++ to do actual string manipulation? I ended up looping the string and turning it into an array and then a join back to a string. There is probably a better way to do this in a more modern version of JS, but I am now starting to see why JS is a pariah on here. It has some quirks that make you question your devlife choices.
What was I working on? Some stupid crop circle thingy. I was trying to use the QML Canvas to draw some "simple" crop circles. So I started with this crop circle:
https://plus.maths.org/content/...
The result ended up being kind of a swirling crop circle thing. The static image was too boring:
https://imgur.com/gallery/900hogf
And yes, I was too lazy/cheap to license the screen capture program.
rant
string
wtf
javascript