I realize this could be added in c++ but I’m wondering of there are any free functions or string methods to convert string case?
It’s all already there, just bind a function to it.
Heh, that could be said for anything. It’s already there just add it.
Trivial as it is, I wanted to make sure I was not injecting a function into the engine where one already existed.
ChaiScript is kept bare on purpose (@lefticus may correct me here if I am wrong) and such functions as tolower() are easily added when required. Maybe some kind of extension module would be a great project if other people require something like a stdlib. (I won’t need it as I like to implement only the ones I need)
Yeah, @aggsol, it makes sense to keep it lean.
Especially if you think about providing some kind of standard lib functions for string (split etc.) then the sensible thing to do is to support UTF-8. But having a working tolower/toupper for UTF-8 really opens up a can of worms I rather not touch.
Yeah, as far as I can tell std::string is not compatible with utf-8.
A standard replacement is needed. Separating size in bytes from characters and iterating in code points. UTF-8 cannot be randomly accessed (O(1)) as well without some other memory representation.
Bag of worms.
There’s been discussion about allowing user replacement of the internal std::string for other (ie std::u16string) implementations.
But the goal has been that the ChaiScript string type would “be the expected thing.”