[Newbies] Collection in Smalltalk
cdrick65 at gmail.com
Thu Sep 25 00:39:32 UTC 2008
have a looks at method name containing split
use the method finder
alt+shift+w when split selected...
You should be able to find ;)
2008/9/25 Alex Chi <alex_chi99 at yahoo.com>:
> Thanks. I'll try to start with the indexing table for each character first.
> Anyway do you know how to split string based on more than 1 character, for
> example I want to split string based on some punctuation. I have tried using
> tokenBasedOn, but still can not figured out how to use it for more than 1
> ----- Original Message ----
> From: Cédrick Béler <cdrick65 at gmail.com>
> To: A friendly place to get answers to even the most basic questions about
> Squeak. <beginners at lists.squeakfoundation.org>
> Sent: Wednesday, September 24, 2008 40:44 PM
> Subject: Re: [Newbies] Collection in Smalltalk
> As a start you can do:
> alphabet := $a to: $z.
> coll indexOf: $c returns 4
> to have both upper and lower case:
> alphabet indexOf: yourCaracter asLowercase
> then you iterate on your string collection and add each result...
> not sure about the $ word, but it could be once you detect the sum to be
> hth :)
> but maybe you could reverse the collection so as to have ($a -> 1 ...
> $z -> 26)
> 2008/9/24 Alex Chi <alex_chi99 at yahoo.com>:
>> Hi guys,
>> I am just beginner in Smaltalk and I have some problem with collection in
>> For this problem I have to define the value of an alphabetic character
>> on its location in the alphabet. So 'a' and 'A' each have value 1, 'b'
>> 'B' each have 2, etc. Non-alphabetic characters can be considered to have
>> value 0.
>> The value of a word is the sum of the value of all its characters. So
>> 'Smalltalk' has value 101 and 'abc' has value 6.
>> A dollar word is a word whose value is 100. I want to add a method to the
>> String class that returns all the dollar words in the string.
>> So for example if the input is 'SmallTalk' the result is ('SmallTlk'
>> Please kindly help me guys. Really appreciate your help.
>> Beginners mailing list
>> Beginners at lists.squeakfoundation.org
> Beginners mailing list
> Beginners at lists.squeakfoundation.org
More information about the Beginners