Test to see if text is in column 1

Post Reply
User avatar
Jeff Barnes
Posts: 912
Joined: Sun Oct 09, 2005 1:05 pm
Location: Ontario, Canada
Contact:

Test to see if text is in column 1

Post by Jeff Barnes »

I have a text string that I grab from a Memo field.
What I need to do is find out if certain text in that string is located in the first column of whatever line it may appear in.

Example of the text:

>>
Hello, this is a TEST.
This is another line.
TEST again.
Some other text in the string.
<<

In this case, the word TEST shows up twice. I need to somehow be able to know if TEST starts at column 1.
Thanks,
Jeff Barnes

(FWH 12.01, xHarbour 1.2.1, Bcc582)
User avatar
Armando
Posts: 2479
Joined: Fri Oct 07, 2005 8:20 pm
Location: Toluca, México
Contact:

Re: Test to see if text is in column 1

Post by Armando »

Jeff:

Perhaps the AT() function can helps.

Sample

Code: Select all

       nAtRE    := AT("&RE=",oWrk:TXT)
 
Regards
SOI, s.a. de c.v.
estbucarm@gmail.com
http://www.soisa.mex.tl/
http://sqlcmd.blogspot.com/
Tel. (722) 174 44 45
Carpe diem quam minimum credula postero
User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Re: Test to see if text is in column 1

Post by Enrico Maria Giordano »

Jeff,

Something like this:

Code: Select all

FOR i = 1 TO MLCOUNT( cMemo )
    cLine = MEMOLINE( cMemo, , i )

    IF cLine = cTxt
        // Found!
    ENDIF
NEXT
EMG
User avatar
Jeff Barnes
Posts: 912
Joined: Sun Oct 09, 2005 1:05 pm
Location: Ontario, Canada
Contact:

Re: Test to see if text is in column 1

Post by Jeff Barnes »

Thanks :)
Thanks,
Jeff Barnes

(FWH 12.01, xHarbour 1.2.1, Bcc582)
Post Reply