Class Index | File Index

Classes


Class CeL.native

native objects 的 functions
Defined in: native.origin.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
null module constructor
Method Summary
Method Attributes Method Name and Description
<static>  
CeL.native.checkSQLInput(string)
check input string send to SQL server
<static>  
CeL.native.checkSQLInput_noSpace(string)
check input string send to SQL server 並去掉前後 space
<static>  
CeL.native.format_date(date_value, mode, zero_fill, date_separator, time_separator)
顯示格式化日期 string
<static>  
CeL.native.parse_function(function_name, flag)
函數的文字解譯/取得函數的語法
<static>  
CeL.native.parse_number(number)
轉換字串成數值,包括分數等。分數亦將轉為分數。
<static>  
CeL.native.renew_RegExp_flag(regexp, flag)
重新設定 RegExp object 之 flag
<static>  
CeL.native.to_fixed(digits, max)
取至小數 d 位, 肇因: JScript即使在做加減運算時,有時還是會出現 1.4000000000000001、0.0999999999999998 等數值。此函數可取至 1.4 與 0.1。 c.f.
<static>  
CeL.native.toASCIIcode(text, position)
對付有時 charCodeAt 會傳回 >256 的數值。 若確定編碼是 ASCII (char code 是 0~255) 即可使用此函數替代 charCodeAt。
Class Detail
CeL.native()
null module constructor
Method Detail
<static> {String} CeL.native.checkSQLInput(string)
check input string send to SQL server
Parameters:
{String} string
input string
Since:
2006/10/27 16:36
Returns:
{String} 轉換過的 string
See:
from lib/perl/BaseF.pm (or program/database/BaseF.pm)

<static> {String} CeL.native.checkSQLInput_noSpace(string)
check input string send to SQL server 並去掉前後 space
Parameters:
{String} string
input string
Since:
2006/10/27 16:36
Returns:
{String} 轉換過的 string
See:
from lib/perl/BaseF.pm (or program/database/BaseF.pm) function strip() @ Prototype JavaScript framework

<static> {String} CeL.native.format_date(date_value, mode, zero_fill, date_separator, time_separator)
顯示格式化日期 string
alert(format_date());
Parameters:
date_value
要轉換的 date, 值過小時當作時間, <0 轉成當下時間
{Number} mode
要轉換的 mode
{Boolean} zero_fill
對 0-9 是否補零
{String} date_separator
date separator
{String} time_separator
time separator
Since:
2003/10/18 1:04 修正, 2010/4/16 10:37:30 重構(refactoring)
Returns:
{String} 格式化後的日期
Requires:
setTool,to_fixed
See:
http://www.merlyn.demon.co.uk/js-dates.htm, http://aa.usno.navy.mil/data/docs/JulianDate.html

<static> CeL.native.parse_function(function_name, flag)
函數的文字解譯/取得函數的語法
parsed_data = new parse_function(function_name);
Parameters:
{Function|String} function_name
function name or function structure
flag
=1: reduce
Since:
2010/5/16 23:04:54
Returns:
See:
http://www.interq.or.jp/student/exeal/dss/ref/jscript/object/function.html, Syntax error: http://msdn.microsoft.com/library/en-us/script56/html/js56jserrsyntaxerror.asp

<static> CeL.native.parse_number(number)
轉換字串成數值,包括分數等。分數亦將轉為分數。
Parameters:
{String} number
欲轉換之值
Returns:

<static> {RegExp} CeL.native.renew_RegExp_flag(regexp, flag)
重新設定 RegExp object 之 flag
附帶 'g' flag 的 RegExp 對相同字串作 .test() 時,第二次並不會重設。因此像下面的 expression 兩次並不會得到相同結果。
var r=/,/g,t='a,b';
WScript.Echo(r.test(t)+','+r.test(t));

//	改成這樣就可以了:
var r=/,/g,t='a,b',s=renew_RegExp_flag(r,'-g');
WScript.Echo(s.test(t)+','+s.test(t));

//	這倒沒問題:
r=/,/g,a='a,b';
if(r.test(a))alert(a.replace(r,'_'));

//	delete r.lastIndex; 無效,得用 r.lastIndex=0; 因此下面的亦可:
if(r.global)r.lastIndex=0;
if(r.test(a)){~}
Parameters:
{RegExp} regexp
RegExp object to set
{String} flag
flag of RegExp
Returns:
{RegExp}
See:
http://msdn.microsoft.com/zh-tw/library/x9h97e00(VS.80).aspx, 如果規則運算式已經設定了全域旗標,test 將會從 lastIndex 值表示的位置開始搜尋字串。如果未設定全域旗標,則 test 會略過 lastIndex 值,並從字串之首開始搜尋。 http://www.aptana.com/reference/html/api/RegExp.html

<static> CeL.native.to_fixed(digits, max)
取至小數 d 位, 肇因: JScript即使在做加減運算時,有時還是會出現 1.4000000000000001、0.0999999999999998 等數值。此函數可取至 1.4 與 0.1。 c.f., round()

					
					
					
						
							
Parameters:
{Number} digits
1,2,..: number of decimal places shown
{Number} max Optional
max digits max===0:round() else floor()
Returns:
See:
https://bugzilla.mozilla.org/show_bug.cgi?id=5856 IEEE754の丸め演算は最も報告されるES3「バグ」である。 http://www.jibbering.com/faq/#FAQ4_6 http://en.wikipedia.org/wiki/Rounding

<static> CeL.native.toASCIIcode(text, position)
對付有時 charCodeAt 會傳回 >256 的數值。 若確定編碼是 ASCII (char code 是 0~255) 即可使用此函數替代 charCodeAt。
Parameters:
text
string
position
at what position
Since:
2008/8/2 10:10:49
Returns:
See:
http://www.alanwood.net/demos/charsetdiffs.html

Documentation generated by JsDoc Toolkit 2.4.0 on Fri Aug 05 2011 17:45:24 GMT+0800 (CST)