Conversion | amount | algorithm | convert Private Sub button1_click (ByVal sender as System.Object, ByVal e as System.EventArgs) Handles Button1.Click
Dim Str as String
str = Me.TextBox1.Text.Trim
Dim Isfs as Boolean
If left (str, 1) = "-" Then
ISFS = True
str = str. Remove (0, 1)
Else
ISFS = False
End If
Dim Strpoint as String
Dim Point () as String
Dim J as Int16
Dim JJ () as String
Dim JJJ as String
JJJ = ""
If Str. IndexOf (".") <>-1 Then
Point = Split (str, ".",-1, CompareMethod.Text)
str = point (0)
Strpoint = Point (1)
ReDim JJ (Strpoint. LENGTH-1)
For j = 0 to Strpoint. Length-1
JJ (j) = Left (Strpoint, 1)
Strpoint = Right (Strpoint, Strpoint. LENGTH-1)
JJJ = JJJ + CONVERT (JJ (j))
Next
End If
Dim Strcode as String
Strcode = ""
While Strcode. Length <= str. Length
Strcode = strcode & "2345" & "2346"
End While
Strcode = "1" & Strcode
Strcode = Left (Strcode, str. Length)
Dim I as Int16
Dim A () as String
Dim Strcode1 as String
Dim Countstr as Int16
Dim Strcode2 as String
Countstr = Strcode. Length
ReDim A (strcode. LENGTH-1)
For i = 0 to Countstr-1
A (i) = Right (Strcode, 1)
Strcode = Left (Strcode, Strcode. LENGTH-1)
Strcode1 = Strcode1 & A (i)
Strcode2 = Strcode2 & "," & Mid (str, i + 1, 1) & Mid (strcode1, i + 1, 1)
Next
Strcode2 = Right (Strcode2, Strcode2. LENGTH-1)
Dim newstr () as String
Newstr = Split (Strcode2, ",",-1, CompareMethod.Text)
Dim II as Int16
Dim Laststr as String
Dim Strcode3 as String
Dim Leftstr as String
Dim Rightstr as String
For II = 0 to Newstr. Length-1
Strcode3 = NEWSTR (ii)
Leftstr = Left (strcode3, 1)
Rightstr = Right (strcode3, 1)
Rightstr = Replace (Rightstr, Rightstr, Convert2 (RIGHTSTR))
Leftstr = Replace (Leftstr, LEFTSTR, convert (LEFTSTR))
If leftstr = "0" and (rightstr = "Pick" or rightstr = "Bai" or rightstr = "thousand") Then
Rightstr = ""
End If
If leftstr = "0" and (rightstr = "million" Or Rightstr = "billion") Then
Leftstr = ""
End If
Strcode3 = leftstr & Rightstr
Laststr = laststr & Strcode3
Next
While Laststr. IndexOf ("Bai 0") <>-1
Laststr = Laststr. Replace ("0", "million")
End While
While Laststr. IndexOf ("Thousand 0") <>-1
Laststr = Laststr. Replace ("0", "million")
End While
While Laststr. IndexOf ("0") <>-1
Laststr = Laststr. Replace ("0", "0")
End While
While Laststr. IndexOf ("0") <>-1
Laststr = Laststr. Replace ("0", "billion")
End While
While Laststr. IndexOf ("00") <>-1
Laststr = Laststr. Replace ("00", "0")
End While
While right (LASTSTR, 1) = "0"
Laststr = Left (Laststr, Laststr. LENGTH-1)
End While
If Isfs = True Then
LASTSTR = "negative" & Laststr
End If
If JJJ = "" Then
TD2. InnerHtml = Laststr
Else
If laststr = "" Then
TD2. InnerHtml = "0 points" & JJJ
Else
TD2. InnerHtml = laststr & "dot" & JJJ
End If
End If
End Sub
Function convert (ByVal num as String)
Select Case num
Case "1"
convert = "one"