isSubstringOf? [message #479223] |
Mon, 10 August 2009 10: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 #479226 is a reply to message #479223] |
Mon, 10 August 2009 10:53 |
Eclipse User |
|
|
|
Originally posted by: d.clowes.lboro.ac.uk
I am instead using the matches('.*E.*') operation instead. Still worth
finding out if my understanding of isSubstringOf() is wrong.
Darren
|
|
|
|
Re: isSubstringOf? [message #479281 is a reply to message #479251] |
Mon, 10 August 2009 14:16 |
Eclipse User |
|
|
|
Originally posted by: d.clowes.lboro.ac.uk
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
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.05184 seconds