publicfunctionconvertcurrency(currencydigits:string):string
if(currencydigits.match(/[^,./d]/) !=null)
if((currencydigits).match(/^((/d(,/d)*(.((/d,)*/d))?)|(/d+(./d+)?))$/) ==null)
// normalize the format of input digits:
currencydigits=currencydigits.replace(/,/g, ""); // remove comma delimiters.
currencydigits=currencydigits.replace(/^0+/,"");
// trim zeros at the beginning.
// assert the number is not greater than the maximum number.
if(number(currencydigits) > maximum_number)
// process the coversion from currency digits to characters:
// separate integral and decimal parts before processing coversion:
parts=currencydigits.split(".");
if(parts.length > 1)
else
// prepare the characters corresponding to the digits:
digits=newarray(cn_zero, cn_one, cn_two, cn_three, cn_four, cn_five, cn_six, cn_seven, cn_eight, cn_nine);
radices=newarray("", cn_ten, cn_hundred, cn_thousand);
bigradices=newarray("", cn_ten_thousand, cn_hundred_million);
decimals=newarray(cn_ten_cent, cn_cent);
// start processing:
outputcharacters="";
// process integral part if it is larger than 0:
if(number(integral) > 0)
else
zerocount=0;
outputcharacters+=digits[number(d)] + radices[modulus]; }
if(modulus == 0 && zerocount < 4)
} outputcharacters+=cn_dollar; }
// process decimal part if there is:
if(decimal !="")
} }
// confirm and return the final output string:
if(outputcharacters =="")
if(decimal =="")
outputcharacters=cn_symbol + outputcharacters;
trace("小寫轉換為大寫2:"+ outputcharacters);
returnoutputcharacters; }
字母大小寫轉化
在通用宣告段中,宣告模組級變數x,如下 dim x as string private sub form load x text1.text end sub private sub command1 click text1.text ucase x end sub private sub comma...
vim中大小寫轉化
vim中大小寫轉化的命令是 gu或者gu 形象一點的解釋就是小u意味著轉為小寫 大u意味著轉為大寫.剩下的就是對這兩個命令的限定 限定操作的行,字母,單詞 等等 1 整篇文章大寫轉化為小寫 開啟檔案後,無須進入命令列模式。鍵入 gggug 解釋一下 gggug分作三段gg gu g gg 游標到檔案...
大小寫字母的轉化
方法1 利用tolowercase 將字串轉化為小寫,touppercase 將字串轉化為大寫。注意 轉化過程並不是對原字串s進行轉化,而是需要形成新的字串存到s中。scanner scanner new scanner system.in string s scanner.nextline sys...