Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to delete a character from a string?
Message
 
 
To
17/11/2002 00:15:06
Henry Ravichander
RC Management Systems Inc.
Saskatchewan, Canada
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00723590
Message ID:
00723596
Views:
7
Hi Henry,

You can do something like
DO WHILE LEFT(mFeeApproved,1) = "0" AND LEN(mFeeApproved) > 0
  mFeeApproved = SUBSTR(mFeeApproved,2)
ENDDO
However, you don't have to do that if you just want to convert string into number.
mFee = VAL(mFeeApproved)/100
>Hi all:
>
>I have the following code.
>
>
mSelectedPlace = 1 && first position in a substr
>		mEndPlace = 1 && position to set in a substr
>		DO WHILE mOK = .f.
>			mSelectedCharacter = "" && will hold a char
>			mSelectedCharacter = SUBSTR(mFeeApproved,mSelectedPlace,mEndPlace)
>				IF mSelectedCharacter = "0"
>					DELETE SUBSTR(mFeeApproved,mSelectedPlace,mEndPlace) && code fails here!
>                                        mSelectedPlace = mSelectedPlace + 1
>					mEndPlace = mEndPlace+1
>					LOOP			
>				ELSE
>					EXIT
>					
>				ENDIF
>		enddo
>
>The idea is to check the first char in the string, and if it is a zero, delete it from the variable mFeeApproved. Then loop to the check the next position till no more chars are left in that string to be evaluated.
>
>I would also like to know how to convert mFeeapproved from string to a number i.e. if the final value of mFeeApproved was "2100", I would like it to be converted to a numeric value and display as 21.00.
>
>Thank you for your suggestions.
--sb--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform