siebel escript入门——基础知识一

来源:互联网 发布:java开源社区 编辑:程序博客网 时间:2024/06/07 16:39

1.检测escript变量是否已定义

var test;if(typeof test == "undefined");TheApplication.RaiseErrorText("test is undefined");

2.escript的基本数据类型

escript             javascriptchars               Stringfloat               Numberbool                Booleanundefined

3.escript的对象数据类型有:

String      Boolean     Number      Array       Null        Application     BLOB        BlobDescriptorBuffer      Buscomp         BusObject       CfgItem     Clib        CTIData         CTIService      DateException       File        Math        PropertySet RegExp      SELib       Service     WebApplet

4.使用后需要释放的对象数据

Application    Buscomp  BusObject   CfgItem  CTIService   CTIData PropertySet     Service     WebApplet

5.如何判断变量是否能转换成数字

var Test = "a string";if(isNaN(parseInt(Test)));TheApplication.RaiseErrorText("Test is Not a Number");

6.声明强类型变量——在变量后加上冒号,然后加上数据类型名称

var a : Date = new Date();var BO :BusObject;var BC :Buscomp;

7.escript中的数字运算符

符号              目的              说明=               赋值              将值赋给某个变量+               相加              两个数相加-               相减              一个数减去另外一个数*               相乘              两个数相乘/               相除              一个数除以另外一个数%               求模              返回相除后的余数+=              加法              自身加上其他数-=              减法              自身减去其他数*=              乘法              自身乘以其他数/=              除法              自身除以其他数%=              求模              自身对其他数求模++              自动加1--              自动减1

8.位运算符

操作符               说明                举例<<                  左移<<=>>                  右移>>=>>>                 无符号右移>>>=&                   与&=|                   或|=^                   异或^=~                   非

9.逻辑运算符

符号                  目的              说明!                   逻辑非&&                  逻辑与||                  逻辑或==                  相等!=                  不相等<                   小于>                   大于<=                  小于等于>=                  大于等于

10.escript中比较弱类型变量时比较的是值,但是比较强类型变量时比较的却是变量名称

//返回not equalfunction foo() {    var oStr1:String = new String("aa");    var oStr2:String = new String("aa");    if(oStr1==oStr2)        TheApplication.RaiseErrorText("equal");    else        TheApplication.RaiseErrorText("not equal");}//返回not equal,虽然不是强类型的比较,但是因为String是对象数据类型function foo() {    var oStr1 = new String("aa");    var oStr2 = new String("aa");    if(oStr1==oStr2)        TheApplication.RaiseErrorText("equal");    else        TheApplication.RaiseErrorText("not equal");}

11.确保比较变量时总是能比较值

//方法1:使用valueOf ()function foo (){    var oStr1 = new String("aa");    var oStr2 = new String("aa");    if (oStr1.valueOf()==oStr2.valueOf())        TheApplication().RaiseErrorText("equal");    else        TheApplication().RaiseErrorText("no equal");}
//方法2:使用原生(primitive)数据类型function foo() {    var oStr1:chars="aa";    var oStr2:chars="aa";    if(oStr1==oStr2)        TheApplication.RaiseErrorText("equal");    else        TheApplication.RaiseErrorText("not equal");}

12.typeof运算符,返回值是字符串,可能是
undefined/boolean/string/object/number/function/buffer

var result=typeof variable;var result=typeof(variable);

13.条件运算符

expression ? true : false;
foo=(5<6)?100?200;  //foo=100

14.字符串连接符:+

var proverb = "A rolling stone" + "gathers no moss.";var newString = 4 + "get it";  //4get it
阅读全文
0 0
原创粉丝点击