[haiku-development] Re: BString method SymbolAt() proposal

  • From: Reinhard Scharnagl <ReScharn@xxxxxxx>
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Sat, 19 Jun 2010 13:54:25 +0200

Am 19.06.2010 um 13:42 schrieb Ingo Weinhold:

> While I agree with CharAt() being the more appropriate name and uint32 as a 
> return vaule, ...

What do you intend to do with that uint32 value at this moment, where BString 
or cout is not yet supporting such a type of parameter?

And how would this help e.g. to invert a UTF8 text?

> I disagree with introducing the method at all. It cannot be 
> implemented efficiently and it is bound to be used in a loop which will 
> have O(n^2) complexity.

Why that? I proposed a routine working at a given index inside a BString? 
So there will be just an amount of operations corresponding to the length 
of the symbol at index. So where is the complexity?

> Introducing a BUnicodeString class would be an 
> alternative.

Not without having also a wide char kind of type. 

I tried to propose a very simple BString extension for this moment.

Reinhard (Octopus)


Other related posts: