3 ms·
> NUL, DEL and ESC are control characters. You have confused nomenclature for category. Thus begging the question. > Right; this is what I'm getting at. subst
by tialaramex 4y ago
> NUL, DEL and ESC are control characters.
You have confused nomenclature for category. Thus begging the question.
> Right; this is what I'm getting at. substr(str, A, B) is a low level function: a servant. A and B have a meaning somewhere, but not to this routine.
For the purpose you're talking about the code point index is completely irrelevant, and so the byte index works fine here.
- kazinator 4y agoA character isn't just something that produces a picture, and advances the printing position to the right. Yes, a byte index will work if we have a multi-byte string such as UTF-8; and a code point index would be inconvenient since displacement calculations on it are meaningless. If we are talking about a string as an array of code points (like a wchar_t * string on sane platforms where a wchar_t can hold any code point) then we use code point indexing. C has wmemcpy, wmalloc, wstrlen, ...