Visualizzazione dei risultati da 1 a 6 su 6
  1. #1
    Utente di HTML.it
    Registrato dal
    May 2002
    Messaggi
    156

    trasformare numero double in lettere

    Salve a tutti

    qualcuno sa dove posso trovare la funzione già fatta per asp?
    non ho proprio il tempo di costruirmela...
    grazie

  2. #2

  3. #3
    Utente di HTML.it
    Registrato dal
    May 2002
    Messaggi
    156
    forse mi sono spiegato male
    io cerco una funzione che con
    INPUT: 123,25
    restituisce
    OUTPUT: "Centoventitre/25"

  4. #4
    Utente di HTML.it L'avatar di Baol74
    Registrato dal
    Jul 2002
    Messaggi
    2,004
    ehehe, la devi fare... non esistense neanche nell'entreprise java bean, tantomento in asp

  5. #5
    gooooooogle in questo caso puo' aiutare

  6. #6
    Utente di HTML.it L'avatar di morphy79
    Registrato dal
    Jun 2004
    Messaggi
    1,568
    questo l'ho fatto io... con una semplice modifica sei a posto !!!

    codice:
    <%
    
    Public Function convertNumber(numero)
    
    A1 = Array("","uno","due","tre","quattro","cinque","sei","sette","otto","nove","dieci","undici","dodici","tredici","quattordici","quindici","sedici","diciassette","diciotto","diciannove")
    A2 = Array("","","vent","trent","quarant","cinquant","sessant","settant","ottant","novant")
    A3 = Array("","","venti","trenta","quaranta","cinquanta","sessanta","settanta","ottanta","novanta")
    A4 = Array("","cento","duecento","trecento","quattrocento","cinquecento","seicento","settecento","ottocento","novecento")
    A5 = Array("","mille","duemila","tremila","quattromila","cinquemila","seimila","settemila","ottomila","novemila")
    
    numero_s = ""
    
    'SE NUMERO NON VALIDO 
    if len(numero) =< 0 or len(numero) > 4 then
    	numero_s = ""
    end if
    
    
    'SE NUMERO HA 1 CIFRA
    if len(numero) = 1 then
    	numero_s = A1(numero)
    end if
    
    
    
    'SE NUMERO HA 2 CIFRE
    if len(numero) = 2 then
    
    	' SE LA PRIMA CIFRA è UNO
    	if left(numero,1) = "1" then
    		numero_s = A1(numero)
    	else	
    		' SE LA SECONDA CIFRA è ZERO
    		if right(numero,1) = "0" then
    			numero_s = A3(numero)	
    		else
    			'SE LA SECONDA CIFRA è 1 o 8
    			if right(numero,1) = "1" or right(numero,1) = "8" then
    				numero_s = A2(left(numero,1))
    			else
    				numero_s = A3(left(numero,1))
    			end if
    		
    			numero_s = numero_s & A1(right(numero,1))
    
    		end if
    	end if
    
    end if
    
    
    'SE NUMERO HA 3 CIFRE
    if len(numero) = 3 then
    
    	primaCifra = left(numero,1)
    	numero_cent = A4(primaCifra)
    
    	numeroDecimale = right(numero,2)
    
    	' SE LA PRIMA CIFRA è UNO
    	if left(numeroDecimale,1) = "1" then
    		numero_s = numero_cent & A1(numeroDecimale)
    	else	
    		' SE LA SECONDA CIFRA è ZERO
    		if right(numeroDecimale,1) = "0" then
    			numero_s = numero_cent & A3(numeroDecimale)	
    		else
    			'SE LA SECONDA CIFRA è 1 o 8
    			if right(numeroDecimale,1) = "1" or right(numeroDecimale,1) = "8" then			
    				numero_s = A2(left(numeroDecimale,1))
    			else
    				numero_s = A3(left(numeroDecimale,1))
    			end if
    		
    			numero_s = numero_cent & numero_s & A1(right(numeroDecimale,1))
    
    		end if
    	end if
    	
    end if
    
    
    'SE NUMERO HA 4 CIFRE
    if len(numero) = 4 then
    
    	primaCifra = left(numero,1)
    	numero_mill = A5(primaCifra)
    	
    	primaCifra = mid(numero,2,1)
    	numero_cent = A4(primaCifra)
    
    	numeroDecimale = right(numero,2)
    
    	' SE LA PRIMA CIFRA è UNO
    	if left(numeroDecimale,1) = "1" then
    		numero_s = numero_mill & numero_cent & A1(numeroDecimale)
    	else	
    		' SE LA SECONDA CIFRA è ZERO
    		if right(numeroDecimale,1) = "0" then
    			numero_s = numero_mill & numero_cent & A3(numeroDecimale)	
    		else
    			'SE LA SECONDA CIFRA è 1 o 8
    			if right(numeroDecimale,1) = "1" or right(numeroDecimale,1) = "8" then
    				numero_s = A2(left(numeroDecimale,1))
    			else
    				numero_s = A3(left(numeroDecimale,1))
    			end if
    		
    			numero_s = numero_mill & numero_cent & numero_s & A1(right(numeroDecimale,1))
    
    		end if
    	end if
    	
    end if
    
    
    
    
    
    
    
    convertNumber = numero_s
    
    End Function
    %>
    odio chi parla di politica..
    anzi vorrei fondare un partito contro tutto ciò

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.