isSubstringOf? [message #479223] |
Mon, 10 August 2009 06:28  |
Eclipse User |
|
|
|
Originally posted by: d.clowes.lboro.ac.uk
I am understanding this operation correctly or is there a bug?
If I do 'J.0E1'.isSubstringOf('E').println(); I get false when I'm
expecting true as 'E' is a substring of tEst.
Am I doing something wrong? has anyone else used this operation?
|
|
|
|
|
|
Re: isSubstringOf? [message #479330 is a reply to message #479281] |
Mon, 10 August 2009 13:13  |
Eclipse User |
|
|
|
Darren Clowes wrote:
> Louis Rose wrote:
>
>> The isSubstringOf expression can feel a little unnatural. It's
>> actually called *on* the (possible) substring. In the context of your
>> example:
>
>> 'J.0E1'.isSubstringOf('E') -- returns false, J.0E1 is not a substring
>> of E
>
>> 'E'.isSubstringOf('J.0E1') -- returns true, E is a substring of J.0E1
>
>> Cheers,
>> Louis.
> Thanks Louis,
>
> It just seems opposite to what the book says:
>
> isSubstringOf(str : String) :
> Boolean
>
> Returns true iff str is a sub-string of
> the string the operation is invoked
> on
>
You're right! Looks like a typo - I've fixed the description now.
Apologies for the misinformation, but thanks for finding it!
Cheers,
Louis.
|
|
|
Re: isSubstringOf? [message #573341 is a reply to message #479223] |
Mon, 10 August 2009 06:53  |
Eclipse User |
|
|
|
I am instead using the matches('.*E.*') operation instead. Still worth
finding out if my understanding of isSubstringOf() is wrong.
Darren
|
|
|
Re: isSubstringOf? [message #573368 is a reply to message #479223] |
Mon, 10 August 2009 08:42  |
Eclipse User |
|
|
|
Darren Clowes wrote:
> I am understanding this operation correctly or is there a bug?
>
> If I do 'J.0E1'.isSubstringOf('E').println(); I get false when I'm
> expecting true as 'E' is a substring of tEst.
>
> Am I doing something wrong? has anyone else used this operation?
>
Darren,
The isSubstringOf expression can feel a little unnatural. It's actually
called *on* the (possible) substring. In the context of your example:
'J.0E1'.isSubstringOf('E') -- returns false, J.0E1 is not a substring of E
'E'.isSubstringOf('J.0E1') -- returns true, E is a substring of J.0E1
Cheers,
Louis.
|
|
|
Re: isSubstringOf? [message #573390 is a reply to message #479251] |
Mon, 10 August 2009 10:16  |
Eclipse User |
|
|
|
Louis Rose wrote:
> The isSubstringOf expression can feel a little unnatural. It's actually
> called *on* the (possible) substring. In the context of your example:
> 'J.0E1'.isSubstringOf('E') -- returns false, J.0E1 is not a substring of E
> 'E'.isSubstringOf('J.0E1') -- returns true, E is a substring of J.0E1
> Cheers,
> Louis.
Thanks Louis,
It just seems opposite to what the book says:
isSubstringOf(str : String) :
Boolean
Returns true iff str is a sub-string of
the string the operation is invoked
on
|
|
|
Re: isSubstringOf? [message #573450 is a reply to message #479281] |
Mon, 10 August 2009 13:13  |
Eclipse User |
|
|
|
Darren Clowes wrote:
> Louis Rose wrote:
>
>> The isSubstringOf expression can feel a little unnatural. It's
>> actually called *on* the (possible) substring. In the context of your
>> example:
>
>> 'J.0E1'.isSubstringOf('E') -- returns false, J.0E1 is not a substring
>> of E
>
>> 'E'.isSubstringOf('J.0E1') -- returns true, E is a substring of J.0E1
>
>> Cheers,
>> Louis.
> Thanks Louis,
>
> It just seems opposite to what the book says:
>
> isSubstringOf(str : String) :
> Boolean
>
> Returns true iff str is a sub-string of
> the string the operation is invoked
> on
>
You're right! Looks like a typo - I've fixed the description now.
Apologies for the misinformation, but thanks for finding it!
Cheers,
Louis.
|
|
|
Powered by
FUDForum. Page generated in 0.05206 seconds