You might find it annoying to pass around the length along with the start index of text.
Consider this an opportunity to reflect upon useful conventions of the past like C strings
that declare the end of text is a 0 value character \0
.
Don't want to pass around a byte packed data structure? Consider passing around json.
You are in control of your representations in memory and what they mean and if they are appropriate for your use cases!