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

True greatness consists in being great in little things.
- Charles Simmons
Next
Reply
Map
View

Click here to load this message in the networking platform