mirror of
https://scm.univ-tours.fr/22107988t/rappaurio-sae501_502.git
synced 2025-08-29 21:05:57 +02:00
955 lines
23 KiB
HTML
955 lines
23 KiB
HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||
<head>
|
||
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
|
||
<meta name="generator" content="JsDoc Toolkit" />
|
||
|
||
<title>JsDoc Reference - CeL.native</title>
|
||
|
||
<style type="text/css">
|
||
/* default.css */
|
||
body
|
||
{
|
||
font: 12px "Lucida Grande", Tahoma, Arial, Helvetica, sans-serif;
|
||
width: 800px;
|
||
}
|
||
|
||
.header
|
||
{
|
||
clear: both;
|
||
background-color: #ccc;
|
||
padding: 8px;
|
||
}
|
||
|
||
h1
|
||
{
|
||
font-size: 150%;
|
||
font-weight: bold;
|
||
padding: 0;
|
||
margin: 1em 0 0 .3em;
|
||
}
|
||
|
||
hr
|
||
{
|
||
border: none 0;
|
||
border-top: 1px solid #7F8FB1;
|
||
height: 1px;
|
||
}
|
||
|
||
pre.code
|
||
{
|
||
display: block;
|
||
padding: 8px;
|
||
border: 1px dashed #ccc;
|
||
}
|
||
|
||
#index
|
||
{
|
||
margin-top: 24px;
|
||
float: left;
|
||
width: 160px;
|
||
position: absolute;
|
||
left: 8px;
|
||
background-color: #F3F3F3;
|
||
padding: 8px;
|
||
}
|
||
|
||
#content
|
||
{
|
||
margin-left: 190px;
|
||
width: 600px;
|
||
}
|
||
|
||
.classList
|
||
{
|
||
list-style-type: none;
|
||
padding: 0;
|
||
margin: 0 0 0 8px;
|
||
font-family: arial, sans-serif;
|
||
font-size: 1em;
|
||
overflow: auto;
|
||
}
|
||
|
||
.classList li
|
||
{
|
||
padding: 0;
|
||
margin: 0 0 8px 0;
|
||
}
|
||
|
||
.summaryTable { width: 100%; }
|
||
|
||
h1.classTitle
|
||
{
|
||
font-size:170%;
|
||
line-height:130%;
|
||
}
|
||
|
||
h2 { font-size: 110%; }
|
||
caption, div.sectionTitle
|
||
{
|
||
background-color: #7F8FB1;
|
||
color: #fff;
|
||
font-size:130%;
|
||
text-align: left;
|
||
padding: 2px 6px 2px 6px;
|
||
border: 1px #7F8FB1 solid;
|
||
}
|
||
|
||
div.sectionTitle { margin-bottom: 8px; }
|
||
.summaryTable thead { display: none; }
|
||
|
||
.summaryTable td
|
||
{
|
||
vertical-align: top;
|
||
padding: 4px;
|
||
border-bottom: 1px #7F8FB1 solid;
|
||
border-right: 1px #7F8FB1 solid;
|
||
}
|
||
|
||
/*col#summaryAttributes {}*/
|
||
.summaryTable td.attributes
|
||
{
|
||
border-left: 1px #7F8FB1 solid;
|
||
width: 140px;
|
||
text-align: right;
|
||
}
|
||
|
||
td.attributes, .fixedFont
|
||
{
|
||
line-height: 15px;
|
||
color: #002EBE;
|
||
font-family: "Courier New",Courier,monospace;
|
||
font-size: 13px;
|
||
}
|
||
|
||
.summaryTable td.nameDescription
|
||
{
|
||
text-align: left;
|
||
font-size: 13px;
|
||
line-height: 15px;
|
||
}
|
||
|
||
.summaryTable td.nameDescription, .description
|
||
{
|
||
line-height: 15px;
|
||
padding: 4px;
|
||
padding-left: 4px;
|
||
}
|
||
|
||
.summaryTable { margin-bottom: 8px; }
|
||
|
||
ul.inheritsList
|
||
{
|
||
list-style: square;
|
||
margin-left: 20px;
|
||
padding-left: 0;
|
||
}
|
||
|
||
.detailList {
|
||
margin-left: 20px;
|
||
line-height: 15px;
|
||
}
|
||
.detailList dt { margin-left: 20px; }
|
||
|
||
.detailList .heading
|
||
{
|
||
font-weight: bold;
|
||
padding-bottom: 6px;
|
||
margin-left: 0;
|
||
}
|
||
|
||
.light, td.attributes, .light a:link, .light a:visited
|
||
{
|
||
color: #777;
|
||
font-style: italic;
|
||
}
|
||
|
||
.fineprint
|
||
{
|
||
text-align: right;
|
||
font-size: 10px;
|
||
}
|
||
</style>
|
||
</head>
|
||
|
||
<body>
|
||
<!-- ============================== header ================================= -->
|
||
<!-- begin static/header.html -->
|
||
<div id="header">
|
||
</div>
|
||
<!-- end static/header.html -->
|
||
|
||
<!-- ============================== classes index ============================ -->
|
||
<div id="index">
|
||
<!-- begin publish.classesIndex -->
|
||
<div align="center"><a href="../index.html">Class Index</a>
|
||
| <a href="../files.html">File Index</a></div>
|
||
<hr />
|
||
<h2>Classes</h2>
|
||
<ul class="classList">
|
||
|
||
<li><i><a href="../symbols/_global_.html">_global_</a></i></li>
|
||
|
||
<li><a href="../symbols/CeL.html">CeL</a></li>
|
||
|
||
<li><a href="../symbols/CeL.code.API.html">CeL.code.API</a></li>
|
||
|
||
<li><a href="../symbols/CeL.code.compatibility.html">CeL.code.compatibility</a></li>
|
||
|
||
<li><a href="../symbols/CeL.code.debug.html">CeL.code.debug</a></li>
|
||
|
||
<li><a href="../symbols/CeL.code.log.html">CeL.code.log</a></li>
|
||
|
||
<li><a href="../symbols/CeL.code.reorganize.html">CeL.code.reorganize</a></li>
|
||
|
||
<li><a href="../symbols/CeL.data.html">CeL.data</a></li>
|
||
|
||
<li><a href="../symbols/CeL.data.CSV.html">CeL.data.CSV</a></li>
|
||
|
||
<li><a href="../symbols/CeL.data.XML.html">CeL.data.XML</a></li>
|
||
|
||
<li><a href="../symbols/CeL.env.html">CeL.env</a></li>
|
||
|
||
<li><a href="../symbols/CeL.IO.file.html">CeL.IO.file</a></li>
|
||
|
||
<li><a href="../symbols/CeL.IO.Windows.file.html">CeL.IO.Windows.file</a></li>
|
||
|
||
<li><a href="../symbols/CeL.locale.html">CeL.locale</a></li>
|
||
|
||
<li><a href="../symbols/CeL.math.html">CeL.math</a></li>
|
||
|
||
<li><a href="../symbols/CeL.math.Hamming.html">CeL.math.Hamming</a></li>
|
||
|
||
<li><a href="../symbols/CeL.math.polynomial.html">CeL.math.polynomial</a></li>
|
||
|
||
<li><a href="../symbols/CeL.math.quotient.html">CeL.math.quotient</a></li>
|
||
|
||
<li><a href="../symbols/CeL.misc.check.html">CeL.misc.check</a></li>
|
||
|
||
<li><a href="../symbols/CeL.native.html">CeL.native</a></li>
|
||
|
||
<li><a href="../symbols/CeL.net.html">CeL.net</a></li>
|
||
|
||
<li><a href="../symbols/CeL.net.Ajax.html">CeL.net.Ajax</a></li>
|
||
|
||
<li><a href="../symbols/CeL.net.form.address.html">CeL.net.form.address</a></li>
|
||
|
||
<li><a href="../symbols/CeL.net.form.bank_account.html">CeL.net.form.bank_account</a></li>
|
||
|
||
<li><a href="../symbols/CeL.net.form.education.html">CeL.net.form.education</a></li>
|
||
|
||
<li><a href="../symbols/CeL.net.form.select_input.html">CeL.net.form.select_input</a></li>
|
||
|
||
<li><a href="../symbols/CeL.net.HTA.html">CeL.net.HTA</a></li>
|
||
|
||
<li><a href="../symbols/CeL.net.map.html">CeL.net.map</a></li>
|
||
|
||
<li><a href="../symbols/CeL.net.SVG.html">CeL.net.SVG</a></li>
|
||
|
||
<li><a href="../symbols/CeL.net.web.html">CeL.net.web</a></li>
|
||
|
||
<li><a href="../symbols/CeL.OS.Windows.html">CeL.OS.Windows</a></li>
|
||
|
||
<li><a href="../symbols/CeL.OS.Windows.job.html">CeL.OS.Windows.job</a></li>
|
||
|
||
<li><a href="../symbols/CeL.OS.Windows.registry.html">CeL.OS.Windows.registry</a></li>
|
||
|
||
<li><a href="../symbols/CeL.OS.WMI.html">CeL.OS.WMI</a></li>
|
||
|
||
</ul>
|
||
<hr />
|
||
<!-- end publish.classesIndex -->
|
||
</div>
|
||
|
||
<div id="content">
|
||
<!-- ============================== class title ============================ -->
|
||
<h1 class="classTitle">
|
||
|
||
Class CeL.native
|
||
</h1>
|
||
|
||
<!-- ============================== class summary ========================== -->
|
||
<p class="description">
|
||
|
||
|
||
|
||
native objects 的 functions
|
||
|
||
|
||
<br /><i>Defined in: </i> <a href="../symbols/src/D__USB_cgi-bin_lib_JS_native.origin.js.html">native.origin.js</a>.
|
||
|
||
</p>
|
||
|
||
<!-- ============================== constructor summary ==================== -->
|
||
|
||
<table class="summaryTable" cellspacing="0" summary="A summary of the constructor documented in the class CeL.native.">
|
||
<caption>Class Summary</caption>
|
||
<thead>
|
||
<tr>
|
||
<th scope="col">Constructor Attributes</th>
|
||
<th scope="col">Constructor Name and Description</th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
<tr>
|
||
<td class="attributes"> </td>
|
||
<td class="nameDescription" >
|
||
<div class="fixedFont">
|
||
<b><a href="../symbols/CeL.native.html#constructor">CeL.native</a></b>()
|
||
</div>
|
||
<div class="description">null module constructor</div>
|
||
</td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
|
||
|
||
<!-- ============================== properties summary ===================== -->
|
||
|
||
|
||
<!-- ============================== methods summary ======================== -->
|
||
|
||
|
||
|
||
<table class="summaryTable" cellspacing="0" summary="A summary of the methods documented in the class CeL.native.">
|
||
<caption>Method Summary</caption>
|
||
<thead>
|
||
<tr>
|
||
<th scope="col">Method Attributes</th>
|
||
<th scope="col">Method Name and Description</th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
|
||
<tr>
|
||
<td class="attributes"><static> </td>
|
||
<td class="nameDescription">
|
||
<div class="fixedFont">CeL.native.<b><a href="../symbols/CeL.native.html#.checkSQLInput">checkSQLInput</a></b>(string)
|
||
</div>
|
||
<div class="description">check input string send to SQL server</div>
|
||
</td>
|
||
</tr>
|
||
|
||
<tr>
|
||
<td class="attributes"><static> </td>
|
||
<td class="nameDescription">
|
||
<div class="fixedFont">CeL.native.<b><a href="../symbols/CeL.native.html#.checkSQLInput_noSpace">checkSQLInput_noSpace</a></b>(string)
|
||
</div>
|
||
<div class="description">check input string send to SQL server 並去掉前後 space</div>
|
||
</td>
|
||
</tr>
|
||
|
||
<tr>
|
||
<td class="attributes"><static> </td>
|
||
<td class="nameDescription">
|
||
<div class="fixedFont">CeL.native.<b><a href="../symbols/CeL.native.html#.format_date">format_date</a></b>(date_value, mode, zero_fill, date_separator, time_separator)
|
||
</div>
|
||
<div class="description">顯示格式化日期 string</div>
|
||
</td>
|
||
</tr>
|
||
|
||
<tr>
|
||
<td class="attributes"><static> </td>
|
||
<td class="nameDescription">
|
||
<div class="fixedFont">CeL.native.<b><a href="../symbols/CeL.native.html#.parse_function">parse_function</a></b>(function_name, flag)
|
||
</div>
|
||
<div class="description">函數的文字解譯/取得函數的語法</div>
|
||
</td>
|
||
</tr>
|
||
|
||
<tr>
|
||
<td class="attributes"><static> </td>
|
||
<td class="nameDescription">
|
||
<div class="fixedFont">CeL.native.<b><a href="../symbols/CeL.native.html#.parse_number">parse_number</a></b>(number)
|
||
</div>
|
||
<div class="description">轉換字串成數值,包括分數等。分數亦將轉為分數。</div>
|
||
</td>
|
||
</tr>
|
||
|
||
<tr>
|
||
<td class="attributes"><static> </td>
|
||
<td class="nameDescription">
|
||
<div class="fixedFont">CeL.native.<b><a href="../symbols/CeL.native.html#.renew_RegExp_flag">renew_RegExp_flag</a></b>(regexp, flag)
|
||
</div>
|
||
<div class="description">重新設定 RegExp object 之 flag</div>
|
||
</td>
|
||
</tr>
|
||
|
||
<tr>
|
||
<td class="attributes"><static> </td>
|
||
<td class="nameDescription">
|
||
<div class="fixedFont">CeL.native.<b><a href="../symbols/CeL.native.html#.to_fixed">to_fixed</a></b>(digits, max)
|
||
</div>
|
||
<div class="description">取至小數 d 位,
|
||
肇因: JScript即使在做加減運算時,有時還是會出現 1.4000000000000001、0.0999999999999998 等數值。此函數可取至 1.4 與 0.1。
|
||
c.f.</div>
|
||
</td>
|
||
</tr>
|
||
|
||
<tr>
|
||
<td class="attributes"><static> </td>
|
||
<td class="nameDescription">
|
||
<div class="fixedFont">CeL.native.<b><a href="../symbols/CeL.native.html#.toASCIIcode">toASCIIcode</a></b>(text, position)
|
||
</div>
|
||
<div class="description">對付有時 charCodeAt 會傳回 >256 的數值。
|
||
若確定編碼是 ASCII (char code 是 0~255) 即可使用此函數替代 charCodeAt。</div>
|
||
</td>
|
||
</tr>
|
||
|
||
</tbody>
|
||
</table>
|
||
|
||
|
||
|
||
|
||
<!-- ============================== events summary ======================== -->
|
||
|
||
|
||
<!-- ============================== constructor details ==================== -->
|
||
|
||
<div class="details"><a name="constructor"> </a>
|
||
<div class="sectionTitle">
|
||
Class Detail
|
||
</div>
|
||
|
||
<div class="fixedFont">
|
||
<b>CeL.native</b>()
|
||
</div>
|
||
|
||
<div class="description">
|
||
null module constructor
|
||
|
||
</div>
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
</div>
|
||
|
||
|
||
<!-- ============================== field details ========================== -->
|
||
|
||
|
||
<!-- ============================== method details ========================= -->
|
||
|
||
<div class="sectionTitle">
|
||
Method Detail
|
||
</div>
|
||
|
||
<a name=".checkSQLInput"> </a>
|
||
<div class="fixedFont"><static>
|
||
|
||
<span class="light">{String}</span>
|
||
<span class="light">CeL.native.</span><b>checkSQLInput</b>(string)
|
||
|
||
</div>
|
||
<div class="description">
|
||
check input string send to SQL server
|
||
|
||
|
||
</div>
|
||
|
||
|
||
|
||
|
||
<dl class="detailList">
|
||
<dt class="heading">Parameters:</dt>
|
||
|
||
<dt>
|
||
<span class="light fixedFont">{String}</span> <b>string</b>
|
||
|
||
</dt>
|
||
<dd>input string</dd>
|
||
|
||
</dl>
|
||
|
||
|
||
|
||
<dl class="detailList">
|
||
<dt class="heading">Since:</dt>
|
||
<dd>2006/10/27 16:36</dd>
|
||
</dl>
|
||
</dl>
|
||
|
||
|
||
|
||
<dl class="detailList">
|
||
<dt class="heading">Returns:</dt>
|
||
|
||
<dd><span class="light fixedFont">{String}</span> 轉換過的 string</dd>
|
||
|
||
</dl>
|
||
|
||
|
||
|
||
<dl class="detailList">
|
||
<dt class="heading">See:</dt>
|
||
|
||
<dd>from lib/perl/BaseF.pm (or program/database/BaseF.pm)</dd>
|
||
|
||
</dl>
|
||
|
||
|
||
<hr />
|
||
|
||
<a name=".checkSQLInput_noSpace"> </a>
|
||
<div class="fixedFont"><static>
|
||
|
||
<span class="light">{String}</span>
|
||
<span class="light">CeL.native.</span><b>checkSQLInput_noSpace</b>(string)
|
||
|
||
</div>
|
||
<div class="description">
|
||
check input string send to SQL server 並去掉前後 space
|
||
|
||
|
||
</div>
|
||
|
||
|
||
|
||
|
||
<dl class="detailList">
|
||
<dt class="heading">Parameters:</dt>
|
||
|
||
<dt>
|
||
<span class="light fixedFont">{String}</span> <b>string</b>
|
||
|
||
</dt>
|
||
<dd>input string</dd>
|
||
|
||
</dl>
|
||
|
||
|
||
|
||
<dl class="detailList">
|
||
<dt class="heading">Since:</dt>
|
||
<dd>2006/10/27 16:36</dd>
|
||
</dl>
|
||
</dl>
|
||
|
||
|
||
|
||
<dl class="detailList">
|
||
<dt class="heading">Returns:</dt>
|
||
|
||
<dd><span class="light fixedFont">{String}</span> 轉換過的 string</dd>
|
||
|
||
</dl>
|
||
|
||
|
||
|
||
<dl class="detailList">
|
||
<dt class="heading">See:</dt>
|
||
|
||
<dd>from lib/perl/BaseF.pm (or program/database/BaseF.pm)
|
||
function strip() @ Prototype JavaScript framework</dd>
|
||
|
||
</dl>
|
||
|
||
|
||
<hr />
|
||
|
||
<a name=".format_date"> </a>
|
||
<div class="fixedFont"><static>
|
||
|
||
<span class="light">{String}</span>
|
||
<span class="light">CeL.native.</span><b>format_date</b>(date_value, mode, zero_fill, date_separator, time_separator)
|
||
|
||
</div>
|
||
<div class="description">
|
||
顯示格式化日期 string
|
||
|
||
|
||
</div>
|
||
|
||
|
||
|
||
<pre class="code">alert(format_date());</pre>
|
||
|
||
|
||
|
||
|
||
<dl class="detailList">
|
||
<dt class="heading">Parameters:</dt>
|
||
|
||
<dt>
|
||
<b>date_value</b>
|
||
|
||
</dt>
|
||
<dd>要轉換的 date, 值過小時當作時間, <0 轉成當下時間</dd>
|
||
|
||
<dt>
|
||
<span class="light fixedFont">{Number}</span> <b>mode</b>
|
||
|
||
</dt>
|
||
<dd>要轉換的 mode</dd>
|
||
|
||
<dt>
|
||
<span class="light fixedFont">{Boolean}</span> <b>zero_fill</b>
|
||
|
||
</dt>
|
||
<dd>對 0-9 是否補零</dd>
|
||
|
||
<dt>
|
||
<span class="light fixedFont">{String}</span> <b>date_separator</b>
|
||
|
||
</dt>
|
||
<dd>date separator</dd>
|
||
|
||
<dt>
|
||
<span class="light fixedFont">{String}</span> <b>time_separator</b>
|
||
|
||
</dt>
|
||
<dd>time separator</dd>
|
||
|
||
</dl>
|
||
|
||
|
||
|
||
<dl class="detailList">
|
||
<dt class="heading">Since:</dt>
|
||
<dd>2003/10/18 1:04 修正, 2010/4/16 10:37:30 重構(refactoring)</dd>
|
||
</dl>
|
||
</dl>
|
||
|
||
|
||
|
||
<dl class="detailList">
|
||
<dt class="heading">Returns:</dt>
|
||
|
||
<dd><span class="light fixedFont">{String}</span> 格式化後的日期</dd>
|
||
|
||
</dl>
|
||
|
||
|
||
<dl class="detailList">
|
||
<dt class="heading">Requires:</dt>
|
||
|
||
<dd>setTool,to_fixed</dd>
|
||
|
||
</dl>
|
||
|
||
|
||
<dl class="detailList">
|
||
<dt class="heading">See:</dt>
|
||
|
||
<dd>http://www.merlyn.demon.co.uk/js-dates.htm,
|
||
http://aa.usno.navy.mil/data/docs/JulianDate.html</dd>
|
||
|
||
</dl>
|
||
|
||
|
||
<hr />
|
||
|
||
<a name=".parse_function"> </a>
|
||
<div class="fixedFont"><static>
|
||
|
||
|
||
<span class="light">CeL.native.</span><b>parse_function</b>(function_name, flag)
|
||
|
||
</div>
|
||
<div class="description">
|
||
函數的文字解譯/取得函數的語法
|
||
|
||
|
||
</div>
|
||
|
||
|
||
|
||
<pre class="code">parsed_data = new parse_function(function_name);</pre>
|
||
|
||
|
||
|
||
|
||
<dl class="detailList">
|
||
<dt class="heading">Parameters:</dt>
|
||
|
||
<dt>
|
||
<span class="light fixedFont">{Function|String}</span> <b>function_name</b>
|
||
|
||
</dt>
|
||
<dd>function name or function structure</dd>
|
||
|
||
<dt>
|
||
<b>flag</b>
|
||
|
||
</dt>
|
||
<dd>=1: reduce</dd>
|
||
|
||
</dl>
|
||
|
||
|
||
|
||
<dl class="detailList">
|
||
<dt class="heading">Since:</dt>
|
||
<dd>2010/5/16 23:04:54</dd>
|
||
</dl>
|
||
</dl>
|
||
|
||
|
||
|
||
<dl class="detailList">
|
||
<dt class="heading">Returns:</dt>
|
||
|
||
<dd></dd>
|
||
|
||
</dl>
|
||
|
||
|
||
|
||
<dl class="detailList">
|
||
<dt class="heading">See:</dt>
|
||
|
||
<dd>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</dd>
|
||
|
||
</dl>
|
||
|
||
|
||
<hr />
|
||
|
||
<a name=".parse_number"> </a>
|
||
<div class="fixedFont"><static>
|
||
|
||
|
||
<span class="light">CeL.native.</span><b>parse_number</b>(number)
|
||
|
||
</div>
|
||
<div class="description">
|
||
轉換字串成數值,包括分數等。分數亦將轉為分數。
|
||
|
||
|
||
</div>
|
||
|
||
|
||
|
||
|
||
<dl class="detailList">
|
||
<dt class="heading">Parameters:</dt>
|
||
|
||
<dt>
|
||
<span class="light fixedFont">{String}</span> <b>number</b>
|
||
|
||
</dt>
|
||
<dd>欲轉換之值</dd>
|
||
|
||
</dl>
|
||
|
||
|
||
|
||
|
||
|
||
<dl class="detailList">
|
||
<dt class="heading">Returns:</dt>
|
||
|
||
<dd></dd>
|
||
|
||
</dl>
|
||
|
||
|
||
|
||
|
||
<hr />
|
||
|
||
<a name=".renew_RegExp_flag"> </a>
|
||
<div class="fixedFont"><static>
|
||
|
||
<span class="light">{RegExp}</span>
|
||
<span class="light">CeL.native.</span><b>renew_RegExp_flag</b>(regexp, flag)
|
||
|
||
</div>
|
||
<div class="description">
|
||
重新設定 RegExp object 之 flag
|
||
|
||
|
||
</div>
|
||
|
||
|
||
|
||
<pre class="code">附帶 '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)){~}</pre>
|
||
|
||
|
||
|
||
|
||
<dl class="detailList">
|
||
<dt class="heading">Parameters:</dt>
|
||
|
||
<dt>
|
||
<span class="light fixedFont">{RegExp}</span> <b>regexp</b>
|
||
|
||
</dt>
|
||
<dd>RegExp object to set</dd>
|
||
|
||
<dt>
|
||
<span class="light fixedFont">{String}</span> <b>flag</b>
|
||
|
||
</dt>
|
||
<dd>flag of RegExp</dd>
|
||
|
||
</dl>
|
||
|
||
|
||
|
||
|
||
|
||
<dl class="detailList">
|
||
<dt class="heading">Returns:</dt>
|
||
|
||
<dd><span class="light fixedFont">{RegExp}</span> </dd>
|
||
|
||
</dl>
|
||
|
||
|
||
|
||
<dl class="detailList">
|
||
<dt class="heading">See:</dt>
|
||
|
||
<dd>http://msdn.microsoft.com/zh-tw/library/x9h97e00(VS.80).aspx,
|
||
如果規則運算式已經設定了全域旗標,test 將會從 lastIndex 值表示的位置開始搜尋字串。如果未設定全域旗標,則 test 會略過 lastIndex 值,並從字串之首開始搜尋。
|
||
http://www.aptana.com/reference/html/api/RegExp.html</dd>
|
||
|
||
</dl>
|
||
|
||
|
||
<hr />
|
||
|
||
<a name=".to_fixed"> </a>
|
||
<div class="fixedFont"><static>
|
||
|
||
|
||
<span class="light">CeL.native.</span><b>to_fixed</b>(digits, max)
|
||
|
||
</div>
|
||
<div class="description">
|
||
取至小數 d 位,
|
||
肇因: JScript即使在做加減運算時,有時還是會出現 1.4000000000000001、0.0999999999999998 等數值。此函數可取至 1.4 與 0.1。
|
||
c.f., round()
|
||
|
||
|
||
</div>
|
||
|
||
|
||
|
||
<pre class="code"></pre>
|
||
|
||
|
||
|
||
|
||
<dl class="detailList">
|
||
<dt class="heading">Parameters:</dt>
|
||
|
||
<dt>
|
||
<span class="light fixedFont">{Number}</span> <b>digits</b>
|
||
|
||
</dt>
|
||
<dd>1,2,..: number of decimal places shown</dd>
|
||
|
||
<dt>
|
||
<span class="light fixedFont">{Number}</span> <b>max</b>
|
||
<i>Optional</i>
|
||
</dt>
|
||
<dd>max digits max===0:round() else floor()</dd>
|
||
|
||
</dl>
|
||
|
||
|
||
|
||
|
||
|
||
<dl class="detailList">
|
||
<dt class="heading">Returns:</dt>
|
||
|
||
<dd></dd>
|
||
|
||
</dl>
|
||
|
||
|
||
|
||
<dl class="detailList">
|
||
<dt class="heading">See:</dt>
|
||
|
||
<dd>https://bugzilla.mozilla.org/show_bug.cgi?id=5856
|
||
IEEE754の丸め演算は最も報告されるES3「バグ」である。
|
||
http://www.jibbering.com/faq/#FAQ4_6
|
||
http://en.wikipedia.org/wiki/Rounding</dd>
|
||
|
||
</dl>
|
||
|
||
|
||
<hr />
|
||
|
||
<a name=".toASCIIcode"> </a>
|
||
<div class="fixedFont"><static>
|
||
|
||
|
||
<span class="light">CeL.native.</span><b>toASCIIcode</b>(text, position)
|
||
|
||
</div>
|
||
<div class="description">
|
||
對付有時 charCodeAt 會傳回 >256 的數值。
|
||
若確定編碼是 ASCII (char code 是 0~255) 即可使用此函數替代 charCodeAt。
|
||
|
||
|
||
</div>
|
||
|
||
|
||
|
||
|
||
<dl class="detailList">
|
||
<dt class="heading">Parameters:</dt>
|
||
|
||
<dt>
|
||
<b>text</b>
|
||
|
||
</dt>
|
||
<dd>string</dd>
|
||
|
||
<dt>
|
||
<b>position</b>
|
||
|
||
</dt>
|
||
<dd>at what position</dd>
|
||
|
||
</dl>
|
||
|
||
|
||
|
||
<dl class="detailList">
|
||
<dt class="heading">Since:</dt>
|
||
<dd>2008/8/2 10:10:49</dd>
|
||
</dl>
|
||
</dl>
|
||
|
||
|
||
|
||
<dl class="detailList">
|
||
<dt class="heading">Returns:</dt>
|
||
|
||
<dd></dd>
|
||
|
||
</dl>
|
||
|
||
|
||
|
||
<dl class="detailList">
|
||
<dt class="heading">See:</dt>
|
||
|
||
<dd>http://www.alanwood.net/demos/charsetdiffs.html</dd>
|
||
|
||
</dl>
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<!-- ============================== event details ========================= -->
|
||
|
||
|
||
<hr />
|
||
</div>
|
||
|
||
|
||
<!-- ============================== footer ================================= -->
|
||
<div class="fineprint" style="clear:both">
|
||
|
||
Documentation generated by <a href="http://code.google.com/p/jsdoc-toolkit/" target="_blank">JsDoc Toolkit</a> 2.4.0 on Fri Aug 05 2011 17:45:24 GMT+0800 (CST)
|
||
</div>
|
||
</body>
|
||
</html>
|