Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

AT() returns 0 even when I copy the example from vfp Book

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
When I try to break up long strings I need the AT() function to help me find the position of certain characters, so far I get a <0> every time I try!
Could you help Please ?! Thank you!
 
Hi amhim,

The AT() function is case sensitive. You might want to use ATC() function instead.

Yue Jeen
 
STORE 'abcde' TO gcSearchString
lnPos=AT('c',gcSearchString)
? lnPos && Displays 3

STORE 'ABCDE' TO gcSearchString
lnPos=AT('c',gcSearchString)
? lnPos && Displays 0

STORE 'abcde' TO gcSearchString
lnPos=ATC('c',gcSearchString)
? lnPos && Displays 3

STORE 'ABCDE' TO gcSearchString
lnPos=ATC('c',gcSearchString)
? lnPos && Displays 3


FYI, AT() is a case-sensitive search. Use ATC() to search without regard to case.

Jon Hawkins
jonscott8@yahoo.com

The World Is Headed For Mutiny,

When All We Want Is Unity. - Creed
 
Not checking my help section but does the SETting of EXACT or ANSI affect this?

John Durbin
john@johndurbin.com
MCP Visual FoxPro

ICQ VFP ActiveList #73897253
 
John,
(Also off the top of my head)-I believe the answer to that is No.

Bare in mind, SET EXACT & SET ANSI are for defining rules when comparing strings of different length.

When AT() does it's comparison, it extracts &quot;sub-strings&quot; from the searched expression and compares that to the search expression. Therefore, the two strings are of equivalent length.

If that makes sense.

Jon Hawkins
jonscott8@yahoo.com

The World Is Headed For Mutiny,

When All We Want Is Unity. - Creed
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top