3 ms·
For a single character, I like to provide an integer value of the number of bytes (or characters, depending) offset from the beginning of the string. For a sub
by FroshKiller 10y ago
For a single character, I like to provide an integer value of the number of bytes (or characters, depending) offset from the beginning of the string.
For a substring, I provide the same starting offset plus another integer for the length (again, in characters or bytes depending on context).
I think you'll find these are very popular approaches.