asp应用中的应用函数(doc47)-经营管理(编辑修改稿)内容摘要:
sert|delete|drop|truncate|from|%|declare| 1 中国最大的管理资源中心 第 19 页 共 45 页 then d if Function end function % ,可以区别中英文 函数在下面,是方法是: strvalue(复请 Email 通知如果不填写则取注册 Email,26) 这里 26 是指 26 个英文字母,也就是 13 个汉字 function strlen(str) dim p_len p_len=0 strlen=0 if trim(str) then p_len=len(trim(str)) for xx=1 to p_len if asc(mid(str,xx,1))0 then strlen=int(strlen) + 2 中国最大的管理资源中心 第 20 页 共 45 页 else strlen=int(strlen) + 1 end if next end if end function function strvalue(str,lennum) dim p_num dim i if strlen(str)=lennum then strvalue=str else p_num=0 x=0 do while not p_num lennum2 x=x+1 if asc(mid(str,x,1))0 then p_num=int(p_num) + 2 else p_num=int(p_num) + 1 end if strvalue=left(trim(str),x)amp。 „ loop end if end function 原数字格式: 2020 中国最大的管理资源中心 第 21 页 共 45 页 格式化后: TWO THOUSAND ONLY 引用: %=make(2020)% 自定义函数: % function zr4(y)’ 准备数据 function zr3(y)’ 准备数据 中国最大的管理资源中心 第 22 页 共 45 页 function zr2(y)’ 准备数据 z(12)=TWELVE function zr1(y)’ 准备数据 dim z(4)=FORTY 中国最大的管理资源中心 第 23 页 共 45 页 function dw(y)’ 准备数据 z(2)=MILLIO function w2(y)’ 用来制作 2 位数字转英文 if MID(y,2,1)=0 then’ 判断是否小于十 elseif MID(y,2,1)=1 then’ 判断是否在十到二十之间 elseif MID(y,3,1)=0 then’ 判断是否为大于二十小于一百的能被十整除的数(为了去掉尾空格) value=zr1(y) else value=zr1(y)+ +zr3(y)’ 加上十位到个位的空格 w2=value function w3(y)’ 用来制作 3 位数字转英文 if MID(y,1,1)=0 then’ 判断是否小于一百 elseif MID(y,2,2)=00 then ’ 判断是否能被一百整除 中国最大的管理资源中心 第 24 页 共 45 页 value=zr4(y)+ +HUNDRED value=zr4(y)+ +HUNDRED+ +AND+ +w2(y)’ 不能 整除 的要 后 面 加“AND” w3=value z=instr(1,x,.,1)’ 取小数点位置 if z0 then’ 判断有没有小数 lstr=mid(x,1,z1)’ 取小数点左边的字串 rstr=mid(x,z+1,2)’ 取小数点右边的字串 lstr=x’ 没有小数的情况 lstrev=StrReverse(lstr)’ 对左边的字串取反字串 dim a(5)’ 定义 5个字串变量用来存放解析出的三位一组的字串 select case len(lstrev) mod 3’ 字串长度不能被整除,需补齐 case 2 lm=’ 用来存放转换后的整数部分 for i=0 to len(lstrev)/31’ 计算有多少个三位 a(i)=StrReverse(mid(lstrev,3*i+1,3))’ 截取第 1 个三位 if a(i)000 then ’ 用来避免这种情况 “1000000=ONE MILLION THOUSAND ONLY” if i0 then 中国最大的管理资源中心 第 25 页 共 45 页 lm=w3(a(i))+ +dw(i)+ +lm’ 用来加上 “THOUSAND OR MILLION OR BILLION” lm=w3(a(i))’ 防止 i=0 时 “lm=w3(a(i))+ +dw(i)+ +lm” 多加两个尾空格 el xs=’ 用来存放转换后的小数部分 if z0 then xs=AND CENTS+ +w2($+rstr)+ ’ 小 数 部 分 存 在 时 转 换 小 数 部 分 make=lm+ +xs+ONLY’ 最后结果,加上 ONLY end function % 文字格式: 12345678 格式化数字: 12,345,678 自定义函数: % Function Comma(str) If Not(IsNumeric(str)) Or str = 0 Then Result = 0 ElseIf Len(Fix(str)) 4 Then Result = str Else Pos = Instr(1,str,.) 中国最大的管理资源中心 第 26 页 共 45 页 If Pos 0 Then Dec = Mid(str,Pos) End if Res = StrReverse(Fix(str)) LoopCount = 1 While LoopCount = Len(Res) TempResult = TempResult + Mid(Res,LoopCount,3) LoopCount = LoopCount + 3 If LoopCount = Len(Res) Then TempResult = TempResult + , End If Wend Result = StrReverse(TempResult) + Dec End If Comma = Result End Function % 引用: % aLongNumber = 12345678 Comma(aLongNumber) % % Function Generator(Length) 中国最大的管理资源中心 第 27 页 共 45 页 dim i, tempS, v dim c(39) tempS = c(1) = a: c(2) = b: c(3) = c: c(4) = d: c(5) = e: c(6) = f: c(7) = g c(8) = h: c(9) = i: c(10) = j: c(11) = k: c(12) = l: c(13) = m: c(14) = n c(15) = o: c(16) = p: c(17) = q: c(18) = r: c(19) = s: c(20) = t: c(21) = u c(22) = v: c(23) = w: c(24) = x: c(25) = y: c(26) = z: c(27) = 1: c(28) = 2 c(29) = 3: c(30) = 4: c(31) = 5: c(32) = 6: c(33) = 7: c(34) = 8: c(35) = 9 c(36) = : c(37) = _: c(38) = @: c(39) = ! If isNumeric(Length) = False Then A numeric datatype was not submitted to this function. Exit Function End If For i = 1 to Length Randomize v = Int((39 * Rnd) + 1) tempS = tempS amp。 c(v) Next Generator = tempS End Fu。asp应用中的应用函数(doc47)-经营管理(编辑修改稿)
阅读剩余 0%
本站所有文章资讯、展示的图片素材等内容均为注册用户上传(部分报媒/平媒内容转载自网络合作媒体),仅供学习参考。
用户通过本站上传、发布的任何内容的知识产权归属用户或原始著作权人所有。如有侵犯您的版权,请联系我们反馈本站将在三个工作日内改正。