[ENH] asDigitVersion

stéphane ducasse ducasse at iam.unibe.ch
Sun Mar 28 16:48:00 UTC 2004


hi andreas

but I did it. self assert: ('111' asDigitVersion: 2) = '111'.
My impression was that it was better to leave it and the user would  
have to check
if he really wants to cut it. I'm not sure that this is the right  
solution.

Stef

On 28 mars 04, at 17:52, Andreas Raab wrote:

> Or simpler:
>
> String>>asDigitVersion: nDigits
>     ^self padded: #left to: nDigits with: $0
>
> Btw, I'm *really* missing a test for the boundary conditions in:
>
>     '11111' asDigitVersion: 2.
>
> Does it raise an error? Does it silently truncate? Does it leave the
> receiver unaffected?
>
> Cheers,
>   - Andreas
>
> ----- Original Message -----
> From: <ducasse at iam.unibe.ch>
> To: <squeak-dev at lists.squeakfoundation.org>
> Sent: Sunday, March 28, 2004 4:11 PM
> Subject: [ENH] asDigitVersion
>
>
>> from preamble:
>>
>> "Change Set: asDigitVersion
>> Date: 28 March 2004
>> Author: stéphane ducasse
>>
>> to generate version string based on a size
>>
>> testAsDigitVersion
>> self assert: ('1' asDigitVersion: 3) = '001'.
>> self assert: ('111' asDigitVersion: 3) = '111'.
>> self assert: ('111' asDigitVersion: 4) = '0111'.
>> self assert: ('111' asDigitVersion: 2) = '111'.
>>
>> "!
>>
>
>
> ----------------------------------------------------------------------- 
> -----
> ----
>
>
>>
>>
>
>




More information about the Squeak-dev mailing list