关键词:
MS Excel Macro para escribir números en letras
Sub NUMEROS_EN_LETRAS() Option Explicit 'Mauricio Baeza 'Samuel Monajaras 'Enero-97 'Ultima modificacion Octubre del 2002 'http://www.vbalym.netfirms.com 'Argumentos: 'Numero = Valor que deseamos convertir en texto 'Moneda = es el nombre de la moneda a mostrar 'Fraccion_Letras = Verdadero para que la fraccion de la moneda ' tambien la convierta a letras 'Fraccion = Es el nombre de la fraccion de la moneda 'Texto_Inicial = Cualquier texto que quieras al principio del resultado 'Texto_Final = Cualquier texto que quieras al finla del resultado 'Estilo = Formato de salida ' 1 = MAYUSCULAS ' 2 = minusculas ' 3 = Tipo Titulo 'Los valores negativos los convierte a positivos 'El valor minimo en 0, el valor maximo es 9,999,999,999,999.99 Public Function Numeros_Letras(ByVal Numero As Double, _ ByVal Moneda As String, _ Optional Fraccion_Letras As Boolean = False, _ Optional Fraccion As String = "", _ Optional Texto_Inicial As String = "", _ Optional Texto_Final As String = "", _ Optional Estilo As Integer = 1) As String Dim strLetras As String Dim NumTmp As String Dim intFraccion As Integer strLetras = Texto_Inicial 'Convertimos a positivo si es negativo Numero = Abs(Numero) NumTmp = Format(Numero, "000000000000000.00") If Numero < 1 Then strLetras = strLetras & "cero " & Plural(Moneda) & " " Else strLetras = strLetras & NumLet(Val(Left(NumTmp, 15))) If Val(NumTmp) = 1 Or Val(NumTmp) < 2 Then strLetras = strLetras & Moneda & " " ElseIf Val(Mid(NumTmp, 4, 12)) = 0 Or Val(Mid(NumTmp, 10, 6)) = 0 Then strLetras = strLetras & "de " & Plural(Moneda) & " " Else strLetras = strLetras & Plural(Moneda) & " " End If End If If Fraccion_Letras Then intFraccion = Val(Right(NumTmp, 2)) Select Case intFraccion Case 0 strLetras = strLetras & "con cero " & Plural(Fraccion) Case 1 strLetras = strLetras & "con un " & Fraccion Case Else strLetras = strLetras & "con " & NumLet(Val(Right(NumTmp, 2))) & Plural(Fraccion) End Select Else strLetras = strLetras & Right(NumTmp, 2) End If strLetras = strLetras & Texto_Final Select Case Estilo Case 1 strLetras = StrConv(strLetras, vbUpperCase) Case 2 strLetras = StrConv(strLetras, vbLowerCase) Case 3 strLetras = StrConv(strLetras, vbProperCase) End Select Numeros_Letras = strLetras End Function Public Function NumLet(ByVal Numero As Double) As String Dim NumTmp As String Dim co1 As Integer Dim co2 As Integer Dim pos As Integer Dim dig As Integer Dim cen As Integer Dim dec As Integer Dim uni As Integer Dim letra1 As String Dim letra2 As String Dim letra3 As String Dim Leyenda As String Dim TFNumero As String NumTmp = Format(Numero, "000000000000000") 'Le da un formato fijo co1 = 1 pos = 1 TFNumero = "" 'Para extraer tres digitos cada vez Do While co1 <= 5 co2 = 1 Do While co2 <= 3 'Extrae un digito cada vez de izquierda a derecha dig = Val(Mid(NumTmp, pos, 1)) Select Case co2 Case 1: cen = dig Case 2: dec = dig Case 3: uni = dig End Select co2 = co2 + 1 pos = pos + 1 Loop letra3 = Centena(uni, dec, cen) letra2 = Decena(uni, dec) letra1 = Unidad(uni, dec) Select Case co1 Case 1 If cen + dec + uni = 1 Then Leyenda = "billon " ElseIf cen + dec + uni > 1 Then Leyenda = "billones " End If Case 2 If cen + dec + uni >= 1 And Val(Mid(NumTmp, 7, 3)) = 0 Then Leyenda = "mil millones " ElseIf cen + dec + uni >= 1 Then Leyenda = "mil " End If Case 3 If cen + dec = 0 And uni = 1 Then Leyenda = "millon " ElseIf cen > 0 Or dec > 0 Or uni > 1 Then Leyenda = "millones " End If Case 4 If cen + dec + uni >= 1 Then Leyenda = "mil " End If Case 5 If cen + dec + uni >= 1 Then Leyenda = "" End If End Select co1 = co1 + 1 TFNumero = TFNumero + letra3 + letra2 + letra1 + Leyenda Leyenda = "" letra1 = "" letra2 = "" letra3 = "" Loop NumLet = TFNumero End Function Private Function Centena(ByVal uni As Integer, ByVal dec As Integer, _ ByVal cen As Integer) As String Dim cTexto As String Select Case cen Case 1 If dec + uni = 0 Then cTexto = "cien " Else cTexto = "ciento " End If Case 2: cTexto = "doscientos " Case 3: cTexto = "trescientos " Case 4: cTexto = "cuatrocientos " Case 5: cTexto = "quinientos " Case 6: cTexto = "seiscientos " Case 7: cTexto = "setecientos " Case 8: cTexto = "ochocientos " Case 9: cTexto = "novecientos " Case Else: cTexto = "" End Select Centena = cTexto End Function Private Function Decena(ByVal uni As Integer, ByVal dec As Integer) As String Dim cTexto As String Select Case dec Case 1: Select Case uni Case 0: cTexto = "diez " Case 1: cTexto = "once " Case 2: cTexto = "doce " Case 3: cTexto = "trece " Case 4: cTexto = "catorce " Case 5: cTexto = "quince " Case 6 To 9: cTexto = "dieci" End Select Case 2: If uni = 0 Then cTexto = "veinte " ElseIf uni > 0 Then cTexto = "veinti" End If Case 3: cTexto = "treinta " Case 4: cTexto = "cuarenta " Case 5: cTexto = "cincuenta " Case 6: cTexto = "sesenta " Case 7: cTexto = "setenta " Case 8: cTexto = "ochenta " Case 9: cTexto = "noventa " Case Else: cTexto = "" End Select If uni > 0 And dec > 2 Then cTexto = cTexto + "y " Decena = cTexto End Function Private Function Unidad(ByVal uni As Integer, ByVal dec As Integer) As String Dim cTexto As String If dec <> 1 Then Select Case uni Case 1: cTexto = "un " Case 2: cTexto = "dos " Case 3: cTexto = "tres " Case 4: cTexto = "cuatro " Case 5: cTexto = "cinco " End Select End If Select Case uni Case 6: cTexto = "seis " Case 7: cTexto = "siete " Case 8: cTexto = "ocho " Case 9: cTexto = "nueve " End Select Unidad = cTexto End Function 'Funcion que convierte al plural el argumento pasado Private Function Plural(ByVal Palabra As String) As String Dim pos As Integer Dim strPal As String If Len(Trim(Palabra)) > 0 Then pos = InStr(1, "aeiou", Right(Palabra, 1), vbTextCompare) If pos > 0 Then strPal = Palabra & "s" Else strPal = Palabra & "es" End If End If Plural = strPal End Function
sumadelosmãºltiplosde3y5entre0-1000[usandoloop";for";]
**Ejemplo:**Losmúltiplosde3y5enelrango0-10son:3,5,6,9;ysusumaes23.int[]multiplos=newint[467];multiplos[0]=0;intindex=0;intsuma=0; //Guardamoslosmúltiplosfor(inti=0;i<1000;i++){if(i%3==0||i%5==0){multiplos[index]=i;index++;}... 查看详情
匈牙利人名日
functionname_day(){#aktuálisdátumlekérdezése$_datum=time(); #hónapokneveimagyarul$_honap=array('január','február','március','április','május','június','július','augusztus','szeptember','október','november','december'); #h... 查看详情
从数据库中选择双拼音域名
...Žè¿›è¡Œè¿‡æ»¤ï¼Œå¾—到åŒæ‹¼åŸŸåã€‚å¢žåŠ ä¸€ä¸ªæ‹¼éŸ³é¢„åˆ¤æ–,过滤掉å‰ä¸¤ä¸ªå—æ¯ä¸ç¬¦åˆæ‹¼éŸ³è¦æ±‚çš„å—符串。<?php/* *Author:... 查看详情
nummaxvalida功能
Descripción:Validaloscamposquerequierendeunnúmeromáximo.Enelcasodequenoseavalidado,llamaalafunciónerrorOutputPreyenviaelelementocomoparámetroRecibe:Elelemento.functionlengthMaxValida(element_form){ //Exploralasclasesdelcampobuscandolasqueincluyennum-max-,ycreaunava... 查看详情
numminvalida功能
Descripción:ValidaloscamposquerequierendeunnúmeromÃnimo.Enelcasodequenoseavalidado,llamaalafunciónerrorOutputPreyenviaelelementocomoparámetro.Recibe:Elelemento.functionnumMinValida(element_form){ //Exploralasclasesdelcampobuscandolasqueincluyennum-min-,ycreaunavari... 查看详情
字符串aleatoreo
Estafuncióndevuelveunstringaleatoreoconunlargoaleatoreo,conunmÃnimoyunmáximo.Elusomáscomúnessoloespecificarellargomáximo.Especialmenteútilparapruebasunitarias.NOTA:dependedehttp://snipplr.com/view/14580/nmero-aleatorio/PublicSharedFunctionTextoAleatorio(OptionalByVallargoMin... 查看详情
multoblvalida功能
Descripción:ValidaloscamposdeselecciónmúltipleobligatoriosenviadosporlafunciónvalidaForm-->http://snipplr.com/view/58245/funcin-validaform-para-validar-formularios-con-parmetros-xml-y-nombres-de-clase/.Enelcasodequenoseavalidado,llamaalafunciónerrorOutputPreyenviaelelementocomopar... 查看详情
47都é“府眜セレクトボックス
<selectlang="ja"xml:lang="ja"> <optionvalue="北海é“">北海é“</option> <optionvalue="é’森県">é’森県</option> <optionvalue="岩手県">岩手ç... 查看详情
如图所示
phpspot開発日誌より引用--ã“ã®ãƒ•ã‚¡ã‚¤ãƒ«ã§ã¯ã€å¤–部ファイルã§ã‚ã‚‹ã€/exec/some.htmlã¨ã„ã†ãƒ•ã‚¡ã‚¤ãƒ«ã‚’èªã¿è¾¼ã‚“ã§ã... 查看详情
unicodejavascript
Conesecodigopuedenagregartildesyñenlosalertoenlasfuncionesdefacebook/*Lasoluciónesutilizarunicode: u00e1->áu00e9->éu00ed->Ãu00f3->óu00fa->úu00c1->Ãu00c9->Éu0 查看详情
telefonofijovalida功能
Descripción:ValidaloscamposdeteléfonosfijosenviadosporlafunciónvalidaForm-->http://snipplr.com/view/58245/funcin-validaform-para-validar-formularios-con-parmetros-xml-y-nombres-de-clase/.Enelcasodequenoseavalidado,llamaalafunciónerrorOutputPreyenviaelelementocomoparámetroRecibe:Ele... 查看详情
isanumbervalida的功能
Descripción:ValidaloscamposquedebenserunnúmeroenviadosporlafunciónvalidaForm-->http://snipplr.com/view/58245/funcin-validaform-para-validar-formularios-con-parmetros-xml-y-nombres-de-clase/.Enelcasodequenoseavalidado,llamaalafunciónerrorOutputPreyenviaelelementocomoparámetroRecibe:... 查看详情
telefonomobilvalida功能
Descripción:ValidaloscamposdeteléfonosfijosenviadosporlafunciónvalidaForm-->http://snipplr.com/view/58245/funcin-validaform-para-validar-formularios-con-parmetros-xml-y-nombres-de-clase/.Enelcasodequenoseavalidado,llamaalafunciónerrorOutputPreyenviaelelementocomoparámetro.Recibe:El... 查看详情
字符串到url生成器-已导入
I'vemadesomechangesfunctiontourl($strText){$strText=preg_replace('/ã|â|á|ä|à /i','a',$strText);$strText=preg_replace('/ê|é|ë|è/i','e',$strText);$strText=preg_replace('/î|Ã|ï|ì/i','i',$strText);$strText=preg_replace('... 查看详情
表中所示的日期和日期
Estoesparaobtenerloscodigosdepaisesdesdegeonames.orgyalmacenarlosenunatabla.SeisobajoCodeIgniter.classWelcome{ functionobtener_codigos_de_paises(){ $this->db->where('iso',''); $query=$this->db->get('country'); foreach($query->result... 查看详情
实现数据库镜像
OláPessoal,NesteartigovoufalarsobreDatabaseMirror,umanovafuncionalidadedoSQLServer2005paraaltadisponibilidade.DatabaseMirrorconsisteembasicamenteumespelhamentodeumbancodedados,umasoluçãoquefornecequaseemtemporealfailoveranÃveldebancodedados,semqualquernecessidadedecompatibilidadedehardwa... 查看详情
阿迪尔·迪尔·阿迪尔·迪尔·阿迪尔·迪尔·迪尔·阿迪尔·迪尔·阿迪尔·迪尔·阿迪尔·迪尔·阿迪尔·迪尔·阿迪尔·阿迪尔·阿迪尔·迪尔·阿迪尔·
/** *fechaMasDias.AñadeelnúmerodeterminadodedÃasalafechapasada *comoparámetro.TieneencuentasisecuentaslosdÃascomohábilesono. *@param fecha fechadepartida *@param dias númerodedÃasaañadir *@param habil booleanoqueindicasisonsolamented... 查看详情
功能:双桨
defquita_acentos(texto) texto=texto.gsub('á','a') texto=texto.gsub('é','e') texto=texto.gsub('Ã','i') texto=texto.gsub('ó','o') texto=texto.gsub('ú','u') end 查看详情