groovy-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul King <pa...@asert.com.au>
Subject Re: search for particular text in a multi-line string
Date Wed, 16 Mar 2016 07:55:33 GMT
Can you give an example of what isn't working as expected? contains()
should be good enough if you have the appropriate line endings in your
expected text. Otherwise regex searching might be the way to go.

Cheers, Paul.

On Wed, Mar 16, 2016 at 2:28 PM, Deng, Lea <Lea.Deng@ccc.govt.nz> wrote:
> I'd like to have your suggestions on searching for particular text in a
> multi-line string.
>
>
>
> I found the contains() method does not work:
>
> boolean isContain = multi_line_String.contains(expectedText)
>
>
>
> Do I have to break down my multi line string into single lines for the
> search? I think that may slow down the search.
>
>
>
> Or is there an object I could use to declare the multi line, instead of
> using String?
>
>
>
> many thanks,
>
> Kind Regards
>
> Lea Deng
>
>
>
> Creating connections to make IT easier for everyone
>
>
>
> Lead Test Analyst
>
> IT Regulatory Services Team
>
> Christchurch City Council
>
> New Zealand
>
> DDI: +64 (3) 941 88 55
>
> Extn: 8855
>
> lea.deng@ccc.govt.nz
>
>
>
> **********************************************************************
> This electronic email and any files transmitted with it are intended
> solely for the use of the individual or entity to whom they are addressed.
>
> The views expressed in this message are those of the individual sender
> and may not necessarily reflect the views of the Christchurch City Council.
>
> If you are not the correct recipient of this email please advise the
> sender and delete.
>
> Christchurch City Council
> http://www.ccc.govt.nz
> **********************************************************************

Mime
View raw message