> but isn't it giving up too much to disallow null characters in the middle of a string?
You can have null characters in the middle of strings:
var s = "foo"
s[1] = '\0'
echo len(s)
echo s[2]
Nim will always append a null character to a string for when it gets passed to a C function, but Nim's string functions work just fine with the string proper containing null characters also.
You can have null characters in the middle of strings:
Nim will always append a null character to a string for when it gets passed to a C function, but Nim's string functions work just fine with the string proper containing null characters also.