Board index » delphi » How to translate to Delphi?

How to translate to Delphi?

Does any one know how to translate this coding to Delphi ?
Thank you.

Function NumberToString (ByVal Value As Variant) As String
    Static NW(0 To 20) As String
    Static NT(2 To 9) As String

    If NW(1) <> "One" Then
        NW(0) = ""
        NW(1) = "One"
        NW(2) = "Two"
        NW(3) = "Three"
        NW(4) = "Four"
        NW(5) = "Five"
        NW(6) = "Six"
        NW(7) = "Seven"
        NW(8) = "Eight"
        NW(9) = "Nine"
        NW(10) = "Ten"
        NW(11) = "Eleven"
        NW(12) = "Twelve"
        NW(13) = "Thir{*word*249}"
        NW(14) = "Four{*word*249}"
        NW(15) = "Fif{*word*249}"
        NW(16) = "Six{*word*249}"
        NW(17) = "Seven{*word*249}"
        NW(18) = "Eigh{*word*249}"
        NW(19) = "Nine{*word*249}"
        NW(20) = "Twenty"

        NT(2) = "Twenty"
        NT(3) = "Thirty"
        NT(4) = "Forty"
        NT(5) = "Fifty"
        NT(6) = "Sixty"
        NT(7) = "Seventy"
        NT(8) = "Eighty"
        NT(9) = "Ninety"
    End If

    Dim Result As String

    If Value >= 100 Then
        Result = NW(Value \ 100) + " Hundred"
        Value = Value Mod 100
        If Value <> 0 Then Result = Result + " "
    End If

    Select Case Value
        Case 1 To 20
            Result = Result + NW(Value)
        Case 21 To 99
            Result = Result + NT(Value \ 10)
            Value = Value Mod 10
            If Value <> 0 Then Result = Result + "-" + LCase$(NW(Value))
    End Select

    NumberToString = Result
End Function

 

Re:How to translate to Delphi?


I'd stop worrying about BASIC and hop over to the DSP
http://mirror.aarnet.edu.au/delphi/ (Australian Mirror) or
http://sunsite.icm.edu.pl/delphi/ and download number2word.zip <G>

Good luck

Pierre
http://delphiotc.finalfiler.com

Re:How to translate to Delphi?


Please, choose the right NG.

Stephen

Re:How to translate to Delphi?


Thanks for help.
Thank you

Pierre du Parte <pie...@finalfiler.com> wrote in article
<7hj837$4...@forums.borland.com>...

Quote
> I'd stop worrying about BASIC and hop over to the DSP
> http://mirror.aarnet.edu.au/delphi/ (Australian Mirror) or
> http://sunsite.icm.edu.pl/delphi/ and download number2word.zip <G>

> Good luck

> Pierre
> http://delphiotc.finalfiler.com

Other Threads