runxinzhi.com
首页
百度搜索
数字翻译成英语
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML> <HEAD> <script type="text/javascript"><!-- var arr1=new Array(""," thousand"," million"," billion") var arr2=new Array("zero","ten","twenty","thirty","forty","fifty","sixty","seventy","eighty","ninety") var arr3=new Array("zero","one","two","three","four","five","six","sever","eight","nine"); var arr4=new Array("ten","eleven","twelve","thirteen","fourteen","fifteen","sixteen","seventeen","eighteen","nineteen"); function Translate(num){ var len=num.length,i,j=0,strRet=""; var cols=Math.ceil(len/3); var first=len-cols*3 var strRet="" for(i=first;i<len;i+=3){ ++j; if(i>=0) num3=num.substring(i,i+3) else num3=num.substring(0,first+3) strEng=English(num3) if(strEng!=""){ if(strRet!="") strRet+="," strRet+=English(num3)+arr1[cols-j] } } return strRet } function English(num){ strRet="" if((num.length==3)&&(num.substr(0,3)!="000")){ if((num.substr(0,1)!="0")){ strRet+=arr3[num.substr(0,1)]+" hundred" if(num.substr(1,2)!="00")strRet+=" and " } num=num.substring(1); } if((num.length==2)){ if((num.substr(0,1)=="0")){ num=num.substring(1) } else if((num.substr(0,1)=="1")){ strRet+=arr4[num.substr(1,2)] } else{ strRet+=arr2[num.substr(0,1)] if(num.substr(1,1)!="0")strRet+="-" num=num.substring(1) } } if((num.length==1)&&(num.substr(0,1)!="0")){ strRet+=arr3[num.substr(0,1)] } return strRet; } // --></script> </HEAD> <BODY> <input id=number value=1234567890><input type=button value=翻译成英文 onclick=alert(Translate(document.all.number.value))> </BODY> </HTML>
运行代码
相关阅读:
hive默认配置 .hiverc
hive 行列转换
hive 全表全字段对比
shell 获取hive表结构
粘包现象与解决方案
win 关闭正在使用的端口
pycharm格式报错: Remove redundant parentheses
博客系统作业
django中间件
django的用户认证组件
原文地址:https://www.cnblogs.com/geass/p/1951484.html
最新文章
(转)C# Stopwatch详解
(转)C# Delegate.Invoke、Delegate.BeginInvoke
(转)c# 属性与索引器
(转)C# 的三种序列化方法
(转+整理)C#中使用GUID
(转)C# Xml进行序列化与反序列化
Input输入控制
网站地址信息
IIS发布网站
angularJs ng-model/ng-bind
热门文章
angularJs select
Js 根据身份证号获取年龄-性别
Angular.JS学习笔记——1
python学习笔记——2
VS2012 InstallShield2013LimitedEdition激活
根据指定日期找出前后30天内生日的客户
about rand and reflect
itchat教程
计算指定时间所在的季度数及当季的第一天和最后一天
hive 存储格式及压缩
Copyright © 2020-2023
润新知