Hi Henry,
I'm curious to know what language you are most trained in.
(It can't be VFP because you're working way too hard to accomplish something as simple as this!)
Here's a better way of trimming leading '0' characters and converting your string to numeric all at once:
mFeeApproved = VAL(mFeeApproved)
SET DECIMALS TO 2
BTW, your "DELETE SUBSTR(mFeeApproved,mSelectedPlace,mEndPlace)" code is failing because the keyword "DELETE" is used to mark table rows for deletion and not removing characters from a string.
If you were trying to remove a character from a string you might try something like this:
m.MyString='abcdefg'
m.MyString=STUFF(m.MyString,3,1,'')
? m.MyString
Good luck!
Hugh
>Hi all:
>
>I have the following code.
>
>
mSelectedPlace = 1
> mEndPlace = 1
> DO WHILE mOK = .f.
> mSelectedCharacter = ""
> mSelectedCharacter = SUBSTR(mFeeApproved,mSelectedPlace,mEndPlace)
> IF mSelectedCharacter = "0"
> DELETE SUBSTR(mFeeApproved,mSelectedPlace,mEndPlace)
> 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.
Microsoft hears loudest what the VFP community says about Visual FoxPro by looking at the bottom line!
Support the product. Buy the latest version!
Hugh Winters @ WorldData 408-512-1131