Test to see if text is in column 1

Test to see if text is in column 1

Postby Jeff Barnes » Fri Sep 08, 2017 2:05 pm

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 16.11, xHarbour 1.2.3, Bcc730)
User avatar
Jeff Barnes
 
Posts: 929
Joined: Sun Oct 09, 2005 1:05 pm
Location: Ontario, Canada

Re: Test to see if text is in column 1

Postby Armando » Fri Sep 08, 2017 2:55 pm

Jeff:

Perhaps the AT() function can helps.

Sample
Code: Select all  Expand view

       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
Armando
 
Posts: 3177
Joined: Fri Oct 07, 2005 8:20 pm
Location: Toluca, México

Re: Test to see if text is in column 1

Postby Enrico Maria Giordano » Fri Sep 08, 2017 4:21 pm

Jeff,

Something like this:

Code: Select all  Expand view
FOR i = 1 TO MLCOUNT( cMemo )
    cLine = MEMOLINE( cMemo, , i )

    IF cLine = cTxt
        // Found!
    ENDIF
NEXT


EMG
User avatar
Enrico Maria Giordano
 
Posts: 8522
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: Test to see if text is in column 1

Postby Jeff Barnes » Fri Sep 08, 2017 6:33 pm

Thanks :)
Thanks,
Jeff Barnes

(FWH 16.11, xHarbour 1.2.3, Bcc730)
User avatar
Jeff Barnes
 
Posts: 929
Joined: Sun Oct 09, 2005 1:05 pm
Location: Ontario, Canada


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 60 guests