Merhaba,
Classic asp para birimini yazıya çevirme fonksiyonuna ihtiyacım var. Yardımlarınızı bekliyorum ücretli ücretsiz olarak.
Ücretli Ücretsiz Yardım Talebi
3
●2.727
- 25-07-2018, 20:10:08
- 25-07-2018, 23:42:45Merhaba
belki işinizi görür. kolay gelsin
<%
Function ExpandPrice(pPrice)
Dim temp: temp = ""
Dim expr: Set expr = New RegExp
expr.Pattern = "^\$(\d+),(\d\d)$"
If expr.test(pPrice) Then
Dim dollars: dollars = expr.Replace(pPrice, "$1")
Dim cents: cents = expr.Replace(pPrice, "$2")
'Response.Write(cents)
If CDbl(dollars) > 1 Then
temp = temp & ExpandNumber(dollars) & " Dollars"
If CDbl(cents) > 0 Then
temp = temp & " And "
End If
ElseIf CDbl(dollars) = 0 Then
temp = temp & ExpandNumber(dollars) & " Zero Dollars "
If CDbl(cents) >= 0 Then
temp = temp & " And "
End If
ElseIf CDbl(dollars) = 1 Then
temp = temp & ExpandNumber(dollars) & " Dollar "
End If
If CDbl(cents) > 1 Then
temp = temp & ExpandNumber(cents) & " Cents"
ElseIf CDbl(cents) = 0 Then
temp = temp & ExpandNumber(cents) & " Zero Cents "
ElseIf CDbl(cents) = 1 Then
temp = temp & ExpandNumber(cents) & " Cent "
End If
End If
Set expr = Nothing
ExpandPrice = temp
End Function
Function ExpandNumber(pNumberStr)
Dim temp: temp = ""
Dim suffixes: suffixes = Array("Thousand ", "Million ", "Billion ", "Trillion ", "Quadrillion ", "Quintillion ", "Sextillion ") ' U.S.
'Dim suffixes: suffixes = Array("Thousand ", "Million ", "Milliard ", "Billion ", "Billiard ", "Trillion ", "Trilliard ") ' European
Dim number: number = String(3 - Len(pNumberStr) Mod 3, "0") & pNumberStr
Dim i, j: j = -1
Dim numPart
For i = Len(number) - 2 To 1 Step -3
numPart = Mid(number, i, 3)
If Clng(numPart > 0) Then
If j > -1 Then
temp = suffixes(j) & temp
End If
temp = GetNumberUnder1000Str(numPart) & temp
End If
j = j + 1
Next
ExpandNumber = temp
End Function
Function GetNumberUnder1000Str(pNumber)
Dim temp: temp = ""
If Len(pNumber) = 3 Then
If CLng(Left(pNumber, 1)) > 0 Then
temp = temp & GetNumberUnder100Str(Left(pNumber, 1)) & " Hundred "
End If
End If
temp = temp & GetNumberUnder100Str(Right("0" & pNumber, 2))
GetNumberUnder1000Str = temp
End Function
Function GetNumberUnder100Str(pNumber)
Dim units: units = Array("", "One ", "Two ", "Three ", "Four ", "Five ", "Six ", "Seven ", "Eight ", "Nine ")
Dim tens: tens = Array("Twenty ", "Thirty ", "Forty ", "Fifty ", "Sixty ", "Seventy ", "Eighty ", "Ninety ")
Dim Digits: Digits = Array("Ten ","Eleven ", "Twelve ", "Thirteen ", "Fourteen ", "Fifteen ", "Sixteen ", "Seventeen ", "Eighteen ", "Nineteen")
If pNumber > 19 Then
GetNumberUnder100Str = tens(Left(pNumber, 1) - 2) & units(Right(pNumber, 1))
ElseIF pNumber >= 10 and pNumber <= 19 Then
GetNumberUnder100Str = Digits(Right(pNumber, 1))
Else
GetNumberUnder100Str = units(Right(pNumber, 1))
End If
End Function
'Example : Response.Write ExpandPrice("$1,99") & "<br />"
Dim vDollar,vCent,vAmount
vDollar = 21121221
vCent = 99
vAmount = "$"&vDollar&","&vCent
Response.Write vAmount &"<br>"
Response.Write ExpandPrice(vAmount)
%> - 26-07-2018, 15:17:49Ben hallettim ihtiyacı olan biri olur belki.
<% Function TLyeCevir (ByVal Sayim) Dim Tampon Dim SagBasamak, SolBasamak Dim DecimalKonum, Toplam ReDim Konum(9) Konum(2) = "Bin" Konum(3) = "Milyon" Konum(4) = "Milyar" Konum(5) = "Trilyon" Sayim = Trim(CStr(Sayim)) DecimalKonum = InStr(Sayim, ",") If DecimalKonum > 0 Then Tampon = Left(Mid(Sayim, DecimalKonum + 1) & "00", 2) SolBasamak = OnlarCevir(Tampon) Sayim = Trim(Left(Sayim, DecimalKonum - 1)) End If Toplam = 1 Do While Sayim <> "" Tampon = YuzlerBasamagiCevir(Right(Sayim, 3)) If Tampon <> "" Then SagBasamak = Tampon & Konum(Toplam) & SagBasamak If Len(Sayim) > 3 Then Sayim = Left(Sayim, Len(Sayim) - 3) Else Sayim = "" End If Toplam = Toplam + 1 Loop Select Case SagBasamak Case "" SagBasamak = "" Case "One" SagBasamak = "BirTürkLirası" Case Else SagBasamak = SagBasamak &"TürkLirası" End Select Select Case SolBasamak Case "" SolBasamak = "" Case "One" SolBasamak = "BirKuruş" Case Else SolBasamak = SolBasamak&"Kuruş" End Select TLyeCevir = temizlikimandangelir(SagBasamak & SolBasamak) End Function Private Function YuzlerBasamagiCevir (ByVal Sayim) Dim Sonuc If CInt(Sayim) = 0 Then Exit Function Sayim = Right("000" & Sayim, 3) If Left(Sayim, 1) = "1" Then Sonuc = "Yüz" elseIf Left(Sayim, 1) < "0" or Left(Sayim, 1)>1 Then Sonuc = DijitaleCevir(Left(Sayim, 1)) & "Yüz" End If If Mid(Sayim, 2, 1) <> "0" Then Sonuc = Sonuc & OnlarCevir(Mid(Sayim, 2)) Else Sonuc = Sonuc & DijitaleCevir(Mid(Sayim, 3)) End If YuzlerBasamagiCevir = Trim(Sonuc) End Function Private Function OnlarCevir (ByVal Onlar) Dim Sonuc If CInt(Left(Onlar, 1)) = 1 Then Select Case CInt(Onlar) Case 10: Sonuc = "On" Case 11: Sonuc = "Onbir" Case 12: Sonuc = "Oniki" Case 13: Sonuc = "Onüç" Case 14: Sonuc = "Ondört" Case 15: Sonuc = "Onbeş" Case 16: Sonuc = "Onaltı" Case 17: Sonuc = "Onyedi" Case 18: Sonuc = "Onsekiz" Case 19: Sonuc = "Ondokuz" Case Else End Select Else Select Case CInt(Left(Onlar, 1)) Case 2: Sonuc = "Yirmi" Case 3: Sonuc = "Otuz" Case 4: Sonuc = "Kırk" Case 5: Sonuc = "Elli" Case 6: Sonuc = "Altmış" Case 7: Sonuc = "Yetmiş" Case 8: Sonuc = "Seksen" Case 9: Sonuc = "Doksan" Case Else End Select Sonuc = Sonuc & DijitaleCevir(Right(Onlar, 1)) End If OnlarCevir = Sonuc End Function Private Function DijitaleCevir (ByVal MyDigit) Select Case CInt(MyDigit) Case 1: DijitaleCevir = "Bir" Case 2: DijitaleCevir = "İki" Case 3: DijitaleCevir = "Üç" Case 4: DijitaleCevir = "Dört" Case 5: DijitaleCevir = "Beş" Case 6: DijitaleCevir = "Altı" Case 7: DijitaleCevir = "Yedi" Case 8: DijitaleCevir = "Sekiz" Case 9: DijitaleCevir = "Dokuz" Case Else: DijitaleCevir = "" End Select End Function Private function temizlikimandangelir(Veri) Veri = Replace(Veri, "BirBin","Bin") temizlikimandangelir=Veri End Function response.write TLyeCevir("120,23") %>