Closed patricksurry closed 5 months ago
There isn't currently such a word, as Tali only uses C-style strings internally for things like the error messages. All of the strings used from Forth are either counted strings (pretty rare, but was used in older Forths - this is a Pascal-style string with the first byte containing the length) or addr u
(this is what all the cool Forth kids are using these days) type strings. Tali compiles them in memory as their starting address and length.
If I had a need for such a word and were going to use it a lot, I'd probably write it in assembly.
I don't see myself using it, but you're welcome to put it in the examples if you find it useful and would like to share it.
I ended up writing a native word for this since I couldn't find one but maybe buried in Tali internals somewhere?
I think it can be implemented in forth as
dup begin count 0= until 1- over -
but is a lot more efficient natively, and I have a bunch of these strings. It it's useful happy to contribute but not sure that it's a standard word.