Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Tom McGinty
  Where is Tom McGinty?
 New York
 New York - United States
 Tom McGinty
 To: tushar Kanvinde
  Where is tushar Kanvinde?
 Kolhapur, Maharastra
 India
 tushar Kanvinde
 Tags
Subject: RE: Wildcard Criteria in Program
Thread ID: 331419 Message ID: 331435 # Views: 42 # Ratings: 0
Version: Visual FoxPro 9 Category: General VFP Topics
Date: Thursday, December 29, 2011 8:48:19 PM         
   


> > I'm using an array and GETWORDNUM to evaluate text files on a line-by-line basis. I need to pluck out the first occurrence in each line where a "word" has a length of 7 and at least one numeric character anywhere in the string. I can't figure out how to include both criteria in an iif. This is how it would look with only the length and checking only the first three words in each line:
> >
> > d = MyArray(1,i)
> >
> > iif(len(getwordnum(d,1)) = 9, getwordnum(d,1),;
> > iif(len(getwordnum(d,2)) = 9, getwordnum(d,2),;
> > iif(len(getwordnum(d,3)) = 9, getwordnum(d,3),;
> > 'ERROR')))
> >
> > Does anyone know how to add the second criteria that the string include a numeric character (0-9)?
> >
> > Thanks in advance.
> >
> > Tom
>
>
for i=1 to getwordcount(d)
>    lcWord=getwordnum(d,i)
>    if len(lcWord)=7 and len(chrtran(lcWord,chrtran(lcWord,'0123456789',''),'')>0)
>       ?lcWord
>       exit
>    endif
> endfor
> 



This may be a dumb question, but the way Tushar wrote that, wouldn't the for loop continue to run after the first hit was found? This needs to be confined to the first "word" that matches the criteria.

Thanks,
Tom

ENTIRE THREAD

Wildcard Criteria in Program Posted by Tom McGinty @ 12/29/2011 7:14:15 PM
RE: Wildcard Criteria in Program Posted by tushar @ 12/29/2011 7:46:52 PM
RE: Wildcard Criteria in Program Posted by Tom McGinty @ 12/29/2011 7:50:01 PM
RE: Wildcard Criteria in Program Posted by Tom McGinty @ 12/29/2011 8:48:19 PM
RE: Wildcard Criteria in Program Posted by Koen Piller @ 12/30/2011 1:46:20 AM
RE: Wildcard Criteria in Program Posted by Tom McGinty @ 12/30/2011 1:52:50 AM
RE: Wildcard Criteria in Program Posted by Jun Tangunan @ 12/30/2011 4:08:41 AM
RE: Wildcard Criteria in Program Posted by Tamar Granor @ 1/2/2012 10:55:05 PM
RE: Wildcard Criteria in Program Posted by Jijo Pappachan @ 1/3/2012 10:44:53 AM