<html>
<head>
<title>String Test</title>
<script src="prototype.js"></script>
<script>
function testStrip()
{
var str=new String(' wanfangdata ');
alert(str.strip());
}
function teststripTags()
{
var str=new String('<html>2002<head>2005<body> ');
alert(str.stripTags());
}
function testtruncate()
{
var str=new String('king123456789987654321');
alert(str.truncate(8,'*'));
}
function testcamelize()
{
var str=new String('Background-color')
alert(str.camelize())
}
function testcapitalize()
{
var str=new String('back');
alert(str.capitalize());
}
function testDasherize()
{
var str=new String('Hello_World');
alert(str.dasherize());
}
function testinspect()
{
alert("sdfj\"sfa".inspect() );
}
function testgsub()
{
alert("skdjfAsfdjkAdk".gsub(/A/,function(match) {return match[0].toLowerCase()}));
}
function testScan()
{
alert("skdjfAsfdjkAdk".scan(/A/,function(){alert('have a A')}));
}
function testUnderscore()
{alert('borderBottomWidth'.underscore());
}
function testTemplate()
{var temp = new Template("被替换");
alert(temp.evaluate('aAklkljkjAkka'));
}
function testTimes()
{
alert('['+'Q'.times(10)+']');
}
function testEval()
{
var str="<script"+">alert('ok');<"+"/script>";
str.evalScripts();
}
</script>
<body>
<p><input type=button value='Strip' onclick='testStrip();' />" wanfangdata " ---> 'wanfangdata'去掉两边的空格</p><br/>
<p><input type=button value='stripTags' onclick='teststripTags();' />“<html>2002<head>2005<body>” ---> '20022005'去掉html标签</p><br/>
<p><input type=button value='truncate' onclick='testtruncate();' />“123456789>987654321” ---> '123456>'字符串截断</p><br/>
<p><input type=button value='camelize' onclick='testcamelize();' />Background-color --->BackgroundColor</p><br/>
<p><input type=button value='capitalize' onclick='testcapitalize();' />back--->Back</p><br/>
<p><input type=button value='inspect' onclick='testinspect();' />sdfj\"sfa--->sdfj"sfa</p><br/>
<p><input type=button value='testgsub' onclick='testgsub();' />skdjfAsfdjkAdk--->skdjfasfdjkadk</p><br/>
<p><input type=button value='testScan' onclick='testScan();' />字符串检测</p><br/>
<p><input type=button value='testTemplate()' onclick='testTemplate();' />字符串模板</p><br/>
<p><input type=button value='testTimes' onclick='testTimes();' />字符串重复</p><br/>
<p><input type=button value='执行脚本' onclick='return testEval();' />执行字符串脚本</p><br/>
<p><input type=button value='testUnderscore' onclick='testUnderscore();' />'borderBottomWidth’.underscore() -> 'border_bottom_width’
</p><br/>
<p><input type=button value='testDasherize' onclick='testDasherize();' />'Hello_World' ---> 'Hello-World'把下划线转化成-</p><br/>
</body>
</html>
分享到:
相关推荐
String.prototype.padStart 符合ES2017规范的String.prototype.padStart填充程序。 如果不可用,请调用其“ shim”方法对String.prototype.padStart进行填充。 该软件包实现了接口。 它可以在ES3支持的环境中工作...
prototype-160-api.rar prototype-160-api.rar
Learning-Robotics-Using-Python-Design-simulate-program-and-prototype-an-interactive-autonomous-mobile-robot-from-scratch-with-the-help-of-Python-ROS-and-Open-CV-.pdf
string.prototype.replaceall 用于String.prototype.replaceAll的ES Proposal规范填充程序。 如果不可用或不String.prototype.replaceAll调用其“ shim”方法对String.prototype.replaceAll进行填充。 该软件包...
Prototype-1.6.0-zh.chm 中文手册。好不容易找到的最新的prototype手册。
python库。 资源全名:eth_prototype-0.2.0-py2.py3-none-any.whl
String.prototype.trimEnd 符合ES2019规范的String.prototype.trimEnd填充程序。 如果不可用,则调用其“ shim”方法对String.prototype.trimEnd进行填充。 该软件包实现了接口。 它可以在ES3支持的环境中工作并...
ember-disable-prototype-extensions-源码.rar
String.prototype.trim 符合ES5规范的String.prototype.trim填充程序。 如果不可用,请调用其“ shim”方法对String.prototype.trim进行填充。 该软件包实现了接口。 它可以在ES3支持的环境中工作,并符合规范( ...
string.prototype.matchall 用于String.prototype.matchAll的ES Proposal规范填充程序。 如果不可用或不String.prototype.matchAll则调用其“ shim”方法对String.prototype.matchAll进行填充。 该软件包实现了...
String.prototype.padEnd 符合ES2017规范的String.prototype.padEnd填充程序。 如果不可用,则调用其“ shim”方法对String.prototype.padEnd进行填充。 该软件包实现了接口。 它可以在ES3支持的环境中工作并符合。 ...
AS-23-Shcherbakov-Prototype-Pollution-Leads-to-RCE
Internet-of-Things-with-Python-Interact-with-the-world-and-rapidly-prototype-IoT-applications-using-Python.pdf
prototype-1.6.0.3.js prototype1.4中文手册(chm) prototype1.5中文手册(chm) prototype1.6英文手册(chm)
prototype-1.6.0.rarprototype-1.6.0.rarprototype-1.6.0.rarprototype-1.6.0.rarprototype-1.6.0.rarprototype-1.6.0.rarprototype-1.6.0.rarprototype-1.6.0.rarprototype-1.6.0.rar
String.prototype.codePoints 针对String.prototype.codePoints的ECMAScript建议 地位 该提案处于第一阶段。 动机 对于包含高于0xFFFF的代码点的语言(例如ECMAScript语法本身),词法分析器需要能够在使用自己的...
prototype-1.7.js
prototype.js 1.4-1.6[全], 需要的朋友可以看看!
prototype-1.6.0.3.js