FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour transform String
Posts: 417
Joined: Tue Feb 23, 2010 03:09 PM
transform String
Posted: Mon Aug 08, 2011 07:29 PM

Hello,

I have a string such as 000000001720.

I need that last two digts are decimals, so the number should be 17.20.

Is there a function to do it?.

Thank you,

FWH 11.11, Harbour 3.1 and Borland C++ 5.82
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: transform String
Posted: Mon Aug 08, 2011 08:25 PM

MsgInfo( Transform( 000000001720, "99,99" ) )

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: transform String
Posted: Mon Aug 08, 2011 08:28 PM

You want to check the string so its last two characters are digits?

EMG

Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: transform String
Posted: Mon Aug 08, 2011 08:31 PM
Antonio Linares wrote:MsgInfo( Transform( 000000001720, "99,99" ) )


Or

Code (fw): Select all Collapse
#include "Fivewin.ch"


FUNCTION MAIN()

    LOCAL cVal := "000000001720"
    LOCAL nVal := VAL( cVal ) / 100

    ? nVal

    RETURN NIL


EMG
Posts: 417
Joined: Tue Feb 23, 2010 03:09 PM
Re: transform String
Posted: Mon Aug 08, 2011 08:53 PM

Thank you Antonio.

No, just transform it.

But previousy I forgot val, so that´s why it did not work

FWH 11.11, Harbour 3.1 and Borland C++ 5.82

Continue the discussion