help-smalltalk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Help-smalltalk] Best way to find if a string begins with a particular s


From: Rick Flower
Subject: [Help-smalltalk] Best way to find if a string begins with a particular string..
Date: Tue, 16 Oct 2012 11:41:06 -0700
User-agent: Apple Webmail/0.6

Hi all..

So I've been writing code this morning to parse various things and I'm not
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..

Thx!

--Rick



reply via email to

[Prev in Thread] Current Thread [Next in Thread]