0% found this document useful (0 votes)
65 views3 pages

Abu Hani

The document contains code for a function that converts a number to text in Arabic. The function takes a double number, currency, and subcurrency as inputs. It contains arrays to map digits to their Arabic word representations. It formats the number, extracts digits, looks up and concatenates the word representations in the correct order based on the number's place value. The resulting string is returned with the currency and subcurrency appended.

Uploaded by

amiin323
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
65 views3 pages

Abu Hani

The document contains code for a function that converts a number to text in Arabic. The function takes a double number, currency, and subcurrency as inputs. It contains arrays to map digits to their Arabic word representations. It formats the number, extracts digits, looks up and concatenates the word representations in the correct order based on the number's place value. The resulting string is returned with the currency and subcurrency appended.

Uploaded by

amiin323
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 3

Attribute VB_Name = "AbuHani"

Function NoToTxt(TheNo As Double, MyCur As String, MySubCur As String) As String


Dim MyArry1(0 To 9) As String
Dim MyArry2(0 To 9) As String
Dim MyArry3(0 To 9) As String
Dim Myno As String
Dim GetNo As String
Dim RdNo As String
Dim My100 As String
Dim My10 As String
Dim My1 As String
Dim My11 As String
Dim My12 As String
Dim GetTxt As String
Dim Mybillion As String
Dim MyMillion As String
Dim MyThou As String
Dim MyHun As String
Dim MyFraction As String
Dim MyAnd As String
Dim I As Integer
Dim ReMark As String

If TheNo > 999999999999.99 Then Exit Function

If TheNo < 0 Then


TheNo = TheNo * -1
ReMark = "����� ��� "
Else
ReMark = "��� "
End If

If TheNo = 0 Then
NoToTxt = "���"
Exit Function
End If

MyAnd = " �"


MyArry1(0) = ""
MyArry1(1) = "����"
MyArry1(2) = "������"
MyArry1(3) = "��������"
MyArry1(4) = "��������"
MyArry1(5) = "�������"
MyArry1(6) = "������"
MyArry1(7) = "�������"
MyArry1(8) = "��������"
MyArry1(9) = "�������"

MyArry2(0) = ""
MyArry2(1) = " ���"
MyArry2(2) = "�����"
MyArry2(3) = "������"
MyArry2(4) = "������"
MyArry2(5) = "�����"
MyArry2(6) = "����"
MyArry2(7) = "�����"
MyArry2(8) = "������"
MyArry2(9) = "�����"

MyArry3(0) = ""
MyArry3(1) = "����"
MyArry3(2) = "�����"
MyArry3(3) = "�����"
MyArry3(4) = "�����"
MyArry3(5) = "����"
MyArry3(6) = "���"
MyArry3(7) = "����"
MyArry3(8) = "������"
MyArry3(9) = "����"
'======================

GetNo = Format(TheNo, "000000000000.00")

I = 0
Do While I < 15

If I < 12 Then
Myno = Mid$(GetNo, I + 1, 3)
Else
Myno = "0" + Mid$(GetNo, I + 2, 2)
End If

If (Mid$(Myno, 1, 3)) > 0 Then

RdNo = Mid$(Myno, 1, 1)
My100 = MyArry1(RdNo)
RdNo = Mid$(Myno, 3, 1)
My1 = MyArry3(RdNo)
RdNo = Mid$(Myno, 2, 1)
My10 = MyArry2(RdNo)

If Mid$(Myno, 2, 2) = 11 Then My11 = "���� ���"


If Mid$(Myno, 2, 2) = 12 Then My12 = "���� ���"
If Mid$(Myno, 2, 2) = 10 Then My10 = "����"

If ((Mid$(Myno, 1, 1)) > 0) And ((Mid$(Myno, 2, 2)) > 0) Then My100 = My100 + MyAnd
If ((Mid$(Myno, 3, 1)) > 0) And ((Mid$(Myno, 2, 1)) > 1) Then My1 = My1 + MyAnd

GetTxt = My100 + My1 + My10

If ((Mid$(Myno, 3, 1)) = 1) And ((Mid$(Myno, 2, 1)) = 1) Then


GetTxt = My100 + My11
If ((Mid$(Myno, 1, 1)) = 0) Then GetTxt = My11
End If

If ((Mid$(Myno, 3, 1)) = 2) And ((Mid$(Myno, 2, 1)) = 1) Then


GetTxt = My100 + My12
If ((Mid$(Myno, 1, 1)) = 0) Then GetTxt = My12
End If

If (I = 0) And (GetTxt <> "") Then


If ((Mid$(Myno, 1, 3)) > 10) Then
Mybillion = GetTxt + " �����"
Else
Mybillion = GetTxt + " �������"
If ((Mid$(Myno, 1, 3)) = 2) Then Mybillion = " �����"
If ((Mid$(Myno, 1, 3)) = 2) Then Mybillion = " �������"
End If
End If

If (I = 3) And (GetTxt <> "") Then

If ((Mid$(Myno, 1, 3)) > 10) Then


MyMillion = GetTxt + " �����"
Else
MyMillion = GetTxt + " ������"
If ((Mid$(Myno, 1, 3)) = 1) Then MyMillion = " �����"
If ((Mid$(Myno, 1, 3)) = 2) Then MyMillion = " �������"
End If
End If

If (I = 6) And (GetTxt <> "") Then


If ((Mid$(Myno, 1, 3)) > 10) Then
MyThou = GetTxt + " ���"
Else
MyThou = GetTxt + " ����"
If ((Mid$(Myno, 3, 1)) = 1) Then MyThou = " ���"
If ((Mid$(Myno, 3, 1)) = 2) Then MyThou = " �����"
End If
End If

If (I = 9) And (GetTxt <> "") Then MyHun = GetTxt


If (I = 12) And (GetTxt <> "") Then MyFraction = GetTxt
End If

I = I + 3
Loop

If (Mybillion <> "") Then


If (MyMillion <> "") Or (MyThou <> "") Or (MyHun <> "") Then Mybillion = Mybillion
+ MyAnd
End If

If (MyMillion <> "") Then


If (MyThou <> "") Or (MyHun <> "") Then MyMillion = MyMillion + MyAnd
End If

If (MyThou <> "") Then


If (MyHun <> "") Then MyThou = MyThou + MyAnd
End If

If MyFraction <> "" Then


If (Mybillion <> "") Or (MyMillion <> "") Or (MyThou <> "") Or (MyHun <> "") Then
NoToTxt = ReMark + Mybillion + MyMillion + MyThou + MyHun + " " + MyCur + MyAnd +
MyFraction + " " + MySubCur
Else
NoToTxt = ReMark + MyFraction + " " + MySubCur
End If
Else
NoToTxt = ReMark + Mybillion + MyMillion + MyThou + MyHun + " " + MyCur
End If

End Function

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy