[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-smalltalk] Best way to find if a string begins with a particul
Re: [Help-smalltalk] Best way to find if a string begins with a particular string..
Wed, 17 Oct 2012 09:21:21 +0200
Mozilla/5.0 (X11; Linux x86_64; rv:16.0) Gecko/20121011 Thunderbird/16.0.1
On 16/10/2012 20:41, Rick Flower wrote:
So I've been writing code this morning to parse various things and I'm
sure what the best way to do for this next piece I need..
I need to determine if a string (read in from a stream) has a specified
string prefix present or not and return a boolean..
So, below are some example strings and the respective results :
'FooBarBaz' isStringPrefixPresent: 'Foo' -->true
'FooBarBaz' isStringPrefixPresent: 'Bar' --> false
'./mycoolfilename' isStringPrefixPresent: './' --> true
Is there a good way to do this without funny looping character by
character? I'll probably do that initially but thought I'd ask from
you that probably know better than I do..
help-smalltalk mailing list
you can use startsWith:
Re: [Help-smalltalk] Best way to find if a string begins with a particular string..,
Gwenaël Casaccio <=