Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Subtract
Message
From
07/03/2006 07:37:26
Erick Miranda
Formata Data Business - Grupo Linx
Contagem, Brazil
 
 
To
07/03/2006 06:41:14
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Environment versions
Visual FoxPro:
VFP 9
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01101978
Message ID:
01102023
Views:
16
Hi,
A bit sample (put it in one PRG and run it):
MESSAGEBOX(VAL(SUBSTR([abc152]		, getNumberPosition([abc152]))))
MESSAGEBOX(VAL(SUBSTR([a152]		, getNumberPosition([a152]))))
MESSAGEBOX(VAL(SUBSTR([152]		, getNumberPosition([152]))))
MESSAGEBOX(VAL(SUBSTR([abcdefg152]	, getNumberPosition([abcdefg152]))))
MESSAGEBOX(VAL(SUBSTR([ab]		, getNumberPosition([ab]))))
RETURN


*- This function return a initial position of number.
*- If have no number, return one position bigger that len of tsText (999)
FUNCTION getNumberPosition(tsText as String) as Number
	LOCAL lnPosition 	as Number
	LOCAL lnFor 		as Number

	lnPosition = 999

	FOR lnFor = 1 TO LEN(tsText)
		lnPosition = MIN(lnPosition, IIF(ISDIGIT(SUBSTR(tsText, lnFor, 1)), lnFor, 999))
	ENDFOR

	RETURN lnPosition
ENDFUNC
Good luck!



>hi,
>If your answer yes ?NO
>In other case you can to do A PARSE and look for a first number and substract it.? I HAVE NO IDEA
>
>THANKS.
>
>>Hi Mohammed,
>>Are your three first positions letter forever and the number begin in the fourth position?
>>If your answer yes so you can to do it:
>>lnSticket = Val(SubStr(Sticket, 4))
>>lnEticket = Val(SubStr(Eticket, 4))
>>In other case you can to do a parse and look for a first number and substract it.
>>Good luck!
>>
>>>hi all,
>>>any idea, help
>>>Sticket=ABC100 CHAR TYPE
>>>Eticket=abc40  CHAR TYPE
>>>NOOFTICKET NUMARIC TYPE
>>>NOOFTICKET=  Sticket- Eticket=60
>>>THANKS
Erick
Força Sempre!
Strength Always!
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform