Thanks for the suggestion. I’ve implemented this for the next release as a shared String method:
String.FromCodePoints(codePoints() As Integer) As String
This is intended as the bulk equivalent of Chr(codePoint). For example:
Var codePoints() As Integer = [72, 101, 108, 108, 111]
Print(String.FromCodePoints(codePoints)) # Hello
Var symbols() As Integer = [65, 9829, 8364, 128640]
Print(String.FromCodePoints(symbols)) # A♥€🚀
I chose a construction method rather than an append method because Objo strings are immutable, so repeated appending would still allocate new strings. String.FromCodePoints() lets the runtime validate the input, compute the final string size, allocate once, and then fill the string directly.
The method accepts Unicode scalar values in the same valid range as Chr():
0 through 0x10FFFF
- excluding surrogate code points
0xD800 through 0xDFFF
Invalid values raise a runtime error rather than being silently replaced.
One important detail: code points above 0xFFFF are stored internally as surrogate pairs, so they still have a Length of 2 in the current string model, matching the existing Chr() behaviour.
This is now documented and internally I've covered it with tests for ASCII, BMP characters, supplementary-plane code points, empty arrays, null characters, and invalid code points.
https://feedback.objo.dev/feature/474