[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: utf

On Wed, Apr 04, 2018 at 07:35:37PM +0200, Nicolas George wrote:
> I am not sure exactly what is your example, but you got its flaw right:
> n is not out of the blue, it was obtained by previously walking the
> string. And in that case, you have all freedom to express n as a more
> convenient entity than an index expressed in terms of chars. A pointer
> maybe, or a pair with both the char index and the octet offset.

The problem is, you reject every single example that everyone gives
you.  I don't know what you expect from us.

You just seem to have Decided, for reasons known only to you, that
The Character Length Of A String Is Not Useful.  Despite literally
decades of programs that have used strlen() in various ways.

Have you never been given ANY kind of problem that involves analysis
of character strings?  Ever?  At all?

What if the question is "Find all the English words that have an E
in the 5th position and a U in the 7th"?

I mean, seriously, at some point you either have to accept that one
of our examples is good enough to justify the existence of strlen()
and character-based string indexing, or we just label you a loon and
ignore everything you say henceforth.

I think most of the REST of us can agree that the character length
and the byte length of a string are BOTH useful quantities, important
in countless ways to countless programs.  And that sometimes your
algorithm wants to treat a string as an indexed array of characters,
and retrieve the nth character.  And that we shouldn't have to dig
up an entire textbook worth of examples to explain this.

Reply to: