Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- PROCEDURE chiffres_en_lettres_ar(x)
- c,Letter1,Letter2,Letter3,Letter4,Letter5,Letter6 are strings
- c1,c2,c3,c4,c5,c6 are int
- c = NumToString(x, "012d")
- c1 = Val(Middle(c,12, 1))
- SWITCH c1
- CASE 1: Letter1 = "واحد"
- CASE 2: Letter1 = "اثنان"
- CASE 3: Letter1 = "ثلاثة"
- CASE 4: Letter1 = "أربعة"
- CASE 5: Letter1 = "خمسة"
- CASE 6: Letter1 = "ستة"
- CASE 7: Letter1 = "سبعة"
- CASE 8: Letter1 = "ثمانية"
- CASE 9: Letter1 = "تسعة"
- OTHER CASE: Letter1 = ""
- END
- c2 = Val(Middle(c, 11, 1))
- SWITCH c2
- CASE 1: Letter2 = "عشر"
- CASE 2: Letter2 = "عشرون"
- CASE 3: Letter2 = "ثلاثون"
- CASE 4: Letter2 = "أربعون"
- CASE 5: Letter2 = "خمسون"
- CASE 6: Letter2 = "ستون"
- CASE 7: Letter2 = "سبعون"
- CASE 8: Letter2 = "ثمانون"
- CASE 9: Letter2 = "تسعون"
- OTHER CASE: Letter2 = ""
- END
- IF Letter1 <> "" AND c2 > 1 THEN Letter2 = Letter1 + " و" + Letter2
- IF Letter2 = "" THEN Letter2 = Letter1
- IF c1 = 0 AND c2 = 1 THEN Letter2 = Letter2 + "ة"
- IF c1 = 1 AND c2 = 1 THEN Letter2 = "إحدى عشرة"
- IF c1 = 2 AND c2 = 1 THEN Letter2 = "اثنا عشر"
- IF c1 > 2 AND c2 = 1 THEN Letter2 = Letter1 + " " + Letter2
- c3 = Val(Middle(c, 10, 1))
- SWITCH c3
- CASE 1: Letter3 = "مائة"
- CASE 2: Letter3 = "مائتان"
- CASE 3: Letter3 = "ثلاثمائة"
- CASE 4: Letter3 = "أربعمائة"
- CASE 5: Letter3 = "خمسمائة"
- CASE 6: Letter3 = "ستمائة"
- CASE 7: Letter3 = "سبعمائة"
- CASE 8: Letter3 = "ثمانمائة"
- CASE 9: Letter3 = "تسعمائة"
- OTHER CASE: Letter3 = ""
- END
- IF Letter3 <> "" AND Letter2 <> "" THEN Letter3 = Letter3 + " و" + Letter2
- IF Letter3 = "" THEN Letter3 = Letter2
- c4 = Val(Middle(c, 7, 3))
- SWITCH c4
- CASE 1: Letter4 = "ألف"
- CASE 2: Letter4 = "ألفان"
- CASE 3 TO 10: Letter4 = chiffres_en_lettres_ar(c4) + " آلاف"
- CASE > 10 : Letter4 = chiffres_en_lettres_ar(c4) + " ألف"
- OTHER CASE: Letter4 = ""
- END
- IF Letter4 <> "" AND Letter3 <> "" THEN Letter4 = Letter4 + " و" + Letter3
- IF Letter4 = "" THEN Letter4 = Letter3
- c5 = Val(Middle(c, 4, 3))
- SWITCH c5
- CASE 1: Letter5 = "مليون"
- CASE 2: Letter5 = "مليونان"
- CASE 3 TO 10: Letter5 = chiffres_en_lettres_ar(c5) + " ملايين"
- CASE > 10: Letter5 = chiffres_en_lettres_ar(c5) + " مليون"
- OTHER CASE: Letter5 = ""
- END
- IF Letter5 <> "" AND Letter4 <> "" THEN Letter5 = Letter5 + " و" + Letter4
- IF Letter5 = "" THEN Letter5 = Letter4
- c6 = Val(Middle(c, 1, 3))
- SWITCH c6
- CASE 1: Letter6 = "مليار"
- CASE 2: Letter6 = "ملياران"
- CASE 3 TO 10: Letter6 = chiffres_en_lettres_ar(c6) + " ملايير"
- CASE > 10: Letter6 = chiffres_en_lettres_ar(c6) + " مليار"
- OTHER CASE: Letter6 = ""
- END
- IF Letter6 <> "" AND Letter5 <> "" THEN Letter6 = Letter6 + " و" + Letter5
- IF Letter6 = "" THEN Letter6 = Letter5
- RESULT Letter6
Add Comment
Please, Sign In to add comment