|
namespace test
//默认空间
//开始按钮_点击操作
function start_click()
var number1=17.95435333//原始数据
traceprint("number1=" & number1)
var temp1=type.cstring(number1)//temp1存放由浮点数转换过来的字符串
var temp2=array[2] //此数组存放分割出的整数部分和小数部分
//temp[0]--整数部分 temp[1]--小数部分
str.split(temp1,".",temp2)//分割
temp2[1]=str.strsub(temp2[1],0,2)//用截取函数得到小数部分所需要的数字(前两位)
temp3=str.strcat(temp2[0],".")//"17"+"."
temp3=str.strcat(temp3,temp2[1])//"17."+"95"
number2=type.cdouble(temp3)//得到你需要的结果
help.messagebox("number2= " & number2 )
endfunction
//退出按钮_点击操作
function exit_click()
help.exit()
endfunction
endnamespace
//空间结束 |
|