[BUG] String>>findFirstInString:inSet:startingAt: does not work if character of interest is last character in String, also WideString

stéphane ducasse ducasse at iam.unibe.ch
Wed May 10 08:43:31 UTC 2006


I hope I will find tests on mantis :)

Stef

On 9 mai 06, at 08:03, John M McIntosh wrote:

> Mantis
> http://bugs.impara.de/view.php?id=3574
>
> IN the XMLWriter class try
>
> String findFirstInString: ' "' inSet: XMLTranslationMap startingAt: 1.
>
> This should return 2, because " is an entry in the  
> XMLTranslationMap, however it return 0, because the code does not  
> consider the last character in the string could be a character we  
> are interested in.
>
> I'll note ByteString has a primitive that implements this method  
> and that primitive does the correct thing.
>
> mmm perhaps a simpler  example.
>
> this example
>
> 'hi-' asWideString  indexOfAnyOf: (CharacterSet newFrom: '  
> -0123456789{}')
>
> that fails and returns zero.
>
> the follow example works, because 'hi-' is a ByteString and the  
> method call resolves to asking the  class of the object to invoke  
> the findFirstInString:inSet:startingAt:  found in ByteString which  
> is the primitive call.
>
> 'hi-'  indexOfAnyOf: (CharacterSet newFrom: ' -0123456789{}')
>
>
>
> --
> ====================================================================== 
> =====
> John M. McIntosh <johnmci at smalltalkconsulting.com> 1-800-477-2659
> Corporate Smalltalk Consulting Ltd.  http:// 
> www.smalltalkconsulting.com
> ====================================================================== 
> =====
>
>




More information about the Squeak-dev mailing list