Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Koen Piller
  Where is Koen Piller?
 Santpoort-Zuid
 Netherlands
 Koen Piller
 To: Glen Villar
  Where is Glen Villar?
 Palayan City
 Philippines
 Glen Villar
 Tags
Subject: RE: string problem
Thread ID: 188592 Message ID: 188975 # Views: 1 # Ratings: 1
Version: Visual FoxPro 7 Category: Forms
Date: Tuesday, August 12, 2008 8:51:17 PM         
   


> Hi Tulips!
>
> I'm sorry I didn't read your first post. However, I added "exit" in my If..Endif to get what you want. (not tested though)
>
>
> LOCAL lcAllNumeric 
> lcAllNumeric = ''
> For nVar = 1 To Len(Alltrim(Thisform.Text1.Value))
>     If Inlist(Substr(Alltrim(Thisform.Text1.Value),nVar,1),'1','2','3','4','5','6','7','8','9','0')
>         lcAllNumeric = m.lcAllNumeric + Substr(Alltrim(Thisform.Text1.Value),nVar,1)
>     Else
> 	Exit  && added to terminate the for..next function if it encouters non-numeric character
>     Endif
> Next
> 

Hi Glen,

I propose to use isdigit i/o inlist() resulting in following generic function:

parameters tcNumber
local lcAllNumeric ,lnVar
lcAllNumeric = ''
for lnVar = 1 to len(alltrim(tcNumber))
	if isdigit(substr(alltrim(tcNumber),lnVar,1))
		lcAllNumeric = m.lcAllNumeric + substr(alltrim(tcNumber),lnVar,1)
	else
		exit
	endif
next
messagebox(m.lcAllNumeric)




Regards,

Koen

ENTIRE THREAD

string problem Posted by tulips @ 8/11/2008 2:17:19 AM
RE: string problem Posted by Jun Tangunan @ 8/11/2008 2:26:51 AM
RE: string problem Posted by tulips @ 8/11/2008 2:30:10 AM
RE: string problem Posted by Jun Tangunan @ 8/11/2008 2:38:51 AM
RE: string problem Posted by tulips @ 8/11/2008 2:50:00 AM
RE: string problem Posted by tulips @ 8/11/2008 3:35:43 AM
RE: string problem Posted by Glenn Villar @ 8/11/2008 3:30:24 AM
RE: string problem Posted by tulips @ 8/11/2008 3:57:44 PM
RE: string problem Posted by Glenn Villar @ 8/12/2008 6:07:16 AM
RE: string problem Posted by Koen Piller @ 8/12/2008 8:51:17 PM
RE: string problem Posted by Glenn Villar @ 8/13/2008 3:11:46 AM
RE: string problem Posted by Cetin Basoz @ 8/12/2008 12:38:26 PM
RE: string problem Posted by Jim Denney @ 8/12/2008 7:26:47 PM
RE: string problem Posted by Jun Tangunan @ 8/13/2008 12:41:55 AM