Código de Visual Basic - Numeros a letras

sin imagen de perfil

Numeros a letrasgráfica de visualizaciones


Visual Basic

Publicado el 21 de Julio del 2003 por Jorge Zacarias
27.148 visualizaciones desde el 21 de Julio del 2003
Código que convierte un valor numérico a su correspondiente texto. El numero puede ir desde -999.999.999.999.999 hasta 999.999.999.999.999. Muy bueno.

Versión 1
estrellaestrellaestrellaestrellaestrella(11)

Publicado el 21 de Julio del 2003gráfica de visualizaciones de la versión: Versión 1
27.149 visualizaciones desde el 21 de Julio del 2003
estrellaestrellaestrellaestrellaestrella
estrellaestrellaestrellaestrella
estrellaestrellaestrella
estrellaestrella
estrella

Si alguno de los archivos de descarga no funciona, comentanos aquí el error.




Comentarios sobre la versión: Versión 1 (11)

7 de Agosto del 2003
estrellaestrellaestrellaestrellaestrella
Muchas gracias amigo. Me fue muy util este codigo.
Responder
12 de Septiembre del 2003
estrellaestrellaestrellaestrellaestrella
la rutina de conversion es muy grande.... :(
Responder
12 de Septiembre del 2003
estrellaestrellaestrellaestrellaestrella
de nuevo yo aqui mi codigo copialo y pega en tu proyecto:

Private Function ESCRITO(TxtNum As String) As String
'Autor : Miguel Antonio Caceres Tello
'Preguntas y Comentarios: [email protected]
'Lima-Peru

If Val(TxtNum) = 0 Then
ESCRITO = "CERO"
Exit Function
End If

Dim TRIO(0 To 9, 0 To 9, 0 To 9) As String 'POR COMODIDAD PERO...
Dim TRIOS As Integer 'numero de trios 'SE, QUE ME GASTA MEMORIA
Dim SALDO As Integer 'saldo de los trios
Dim I As Integer 'contador
Dim P As Integer 'primero
Dim S As Integer 'segundo
Dim T As Integer 'tercero
Dim L As Integer 'largo de la cadena
Dim M As Integer 'millares
Dim Y As String '
Dim UN As String
Dim MIL As String
Dim MILLON As String
Dim MILLONES As String
Dim TMP As String
Dim FRASE As String

Y = " Y "
UN = "UN "
MIL = " MIL "
MILLON = " MILLON "
MILLONES = " MILLONES "

TRIO(0, 0, 0) = ""
TRIO(0, 0, 1) = "UNO"
TRIO(0, 0, 2) = "DOS"
TRIO(0, 0, 3) = "TRES"
TRIO(0, 0, 4) = "CUATRO"
TRIO(0, 0, 5) = "CINCO"
TRIO(0, 0, 6) = "SEIS"
TRIO(0, 0, 7) = "SIETE"
TRIO(0, 0, 8) = "OCHO"
TRIO(0, 0, 9) = "NUEVE"
TRIO(0, 1, 1) = "ONCE"
TRIO(0, 1, 2) = "DOCE"
TRIO(0, 1, 3) = "TRECE"
TRIO(0, 1, 4) = "CATORCE"
TRIO(0, 1, 5) = "QUINCE"
TRIO(0, 1, 6) = "DIECISEIS"
TRIO(0, 1, 7) = "DIECISIETE"
TRIO(0, 1, 8) = "DIECIOCHO"
TRIO(0, 1, 9) = "DIECINUEVE"
TRIO(0, 1, 0) = "DIEZ"
TRIO(0, 2, 0) = "VEINTE"
TRIO(0, 3, 0) = "TREINTA"
TRIO(0, 4, 0) = "CUARENTA"
TRIO(0, 5, 0) = "CINCUENTA"
TRIO(0, 6, 0) = "SESENTA"
TRIO(0, 7, 0) = "SETENTA"
TRIO(0, 8, 0) = "OCHENTA"
TRIO(0, 9, 0) = "NOVENTA"
TRIO(1, 0, 0) = "CIEN"
TRIO(2, 0, 0) = "DOSCIENTOS"
TRIO(3, 0, 0) = "TRESCIENTOS"
TRIO(4, 0, 0) = "CUATROCIENTOS"
TRIO(5, 0, 0) = "QUINIENTOS"
TRIO(6, 0, 0) = "SEISCIENTOS"
TRIO(7, 0, 0) = "SETECIENTOS"
TRIO(8, 0, 0) = "OCHOCIENTOS"
TRIO(9, 0, 0) = "NOVECIENTOS"

L = Len(TxtNum)
TRIOS = Int(L / 3)
If TRIOS > 0 Then
SALDO = L Mod 3
If SALDO > 0 Then
TxtNum = String$(3 - SALDO, 48) + TxtNum
TRIOS = TRIOS + 1
End If
Else
TxtNum = String$(3 - L, 48) + TxtNum
TRIOS = 1
End If

For I = TRIOS To 1 Step -1
P = Val(Mid$(TxtNum, I * 3, 1))
S = Val(Mid$(TxtNum, I * 3 - 1, 1))
T = Val(Mid$(TxtNum, I * 3 - 2, 1))

If M = 1 Or M = 3 Then
If Not P + S + T = 0 Then FRASE = MIL + FRASE
End If
If M = 2 Then
If TRIOS < 4 Then
If P = 1 And S = 0 And T = 0 Then
FRASE = MILLON + FRASE
Else
FRASE = MILLONES + FRASE
End If
Else
FRASE = MILLONES + FRASE
End If
End If

TMP = FRASE
FRASE = ""
If T = 1 And (S > 0 Or P > 0) Then
FRASE = FRASE + TRIO(T, 0, 0) + "TO "
Else
FRASE = FRASE + TRIO(T, 0, 0) + " "
End If
If S = 1 Then
FRASE = FRASE + TRIO(0, S, P)
Else
If Not S = 0 Then FRASE = FRASE + TRIO(0, S, 0)
End If
If S = 0 Then
If P = 1 Then
FRASE = FRASE + UN
ElseIf P > 1 Then
FRASE = FRASE + TRIO(0, 0, P)
End If
ElseIf S > 1 Then
If Not P = 0 Then
If P = 1 Then
FRASE = FRASE + Y + UN
Else
FRASE = FRASE + Y + TRIO(0, 0, P)
End If
End If
End If

FRASE = Trim(FRASE)
FRASE = FRASE + TMP
M = M + 1
Next I

ESCRITO = FRASE
End Function
Responder
17 de Septiembre del 2003
estrellaestrellaestrellaestrellaestrella
Esta estupendo, muchas gracias
Responder
7 de Noviembre del 2003
estrellaestrellaestrellaestrellaestrella
Hola,
Yo tengo una función que es un poco más práctica, está en este sitio hace ya harto tiempo, la gracia es que los números los entrega \"comprensibles\", no dice \"un mil\" por ejemplo, además, si pones un párrafo, convierte los números del párrafo, por ejemplo: 7 de noviembre -> siete de noviembre.

Zonomaz.
Saludos
Responder
Imágen de perfil
26 de Junio del 2019
estrellaestrellaestrellaestrellaestrella
permitirias tu programa de numeros a letras!!
Responder
31 de Enero del 2004
estrellaestrellaestrellaestrellaestrella
Muy bueno
Responder
28 de Marzo del 2004
estrellaestrellaestrellaestrellaestrella
excelente codigo de numeros a letrasmuy util y bien hecho
Responder
10 de Septiembre del 2004
estrellaestrellaestrellaestrellaestrella
Tremendo laburo master, muy bien hecho
Responder
2 de Julio del 2005
estrellaestrellaestrellaestrellaestrella
Excelente funcion, es muy util para cualquir programa que requiere combertir numeros a letras como cheques, recibos, etc.
Responder
24 de Julio del 2007
estrellaestrellaestrellaestrellaestrella
Gracias amigo, que buena rutina.... esta Buenisimo.... todo para convertir de numeros a letras
Responder

Comentar la versión: Versión 1

Nombre
Correo (no se visualiza en la web)
Valoración
Comentarios...
CerrarCerrar
CerrarCerrar
Cerrar

Tienes que ser un usuario registrado para poder insertar imágenes, archivos y/o videos.

Puedes registrarte o validarte desde aquí.

Codigo
Negrita
Subrayado
Tachado
Cursiva
Insertar enlace
Imagen externa
Emoticon
Tabular
Centrar
Titulo
Linea
Disminuir
Aumentar
Vista preliminar
sonreir
dientes
lengua
guiño
enfadado
confundido
llorar
avergonzado
sorprendido
triste
sol
estrella
jarra
camara
taza de cafe
email
beso
bombilla
amor
mal
bien
Es necesario revisar y aceptar las políticas de privacidad

http://lwp-l.com/s728