Prototype 字符串

2019独角兽企业重金招聘Python工程师标准>>> hot3.png

原文地址:http://www.yiibai.com/prototype/prototype_string_processing.html

Prototype 字符串处理:方法操作使用例子 - 学习如何操纵DOM和AJAX使用Prototype JavaScript框架.Prototype提高了一个有用的方法,从琐碎的一系列复杂的String对象.

这里是所有函数列表,字符串处理的例子.

Prototype字符串方法:

注: 确保你有至少1.6版本的的prototype.js.

MethodsDescription
blank()检查是否该字符串是“空白”,意思是空的或含有唯一的空白.
camelize()转换成驼峰相当于由破折号分隔的字符串。例如,'foo-bar“将被转换为'fooBar'.
capitalize()Capitalizes the first letter of a string and downcases all the others.
dasherize()Replaces every instance of the underscore character ("_") by a dash ("-").
empty()Checks if the string is empty.
endsWith()Checks if the string ends with substring.
escapeHTML()Converts HTML special characters to their entity equivalents.
evalJSON()Evaluates the JSON in the string and returns the resulting object.
evalScripts()Evaluates the content of any script block present in the string. Returns an array containing the value returned by each script.
extractScripts()Extracts the content of any script block present in the string and returns them as an array of strings.
gsub()Returns the string with every occurrence of a given pattern replaced by either a regular string, the returned value of a function or a Template string.
include()Check if the string contains a substring.
inspect()Returns a debug-oriented version of the string.
interpolate()Treats the string as a Template and fills it with object's properties.
isJSON()Check if the string is valid JSON by the use of regular expressions. This security method is called internally.
parseQuery()Parses a URI-like query string and returns an object composed of parameter/value pairs.
scan()Allows iterating over every occurrence of the given pattern
startsWith()Checks if the string starts with substring.
strip()Strips all leading and trailing whitespace from a string.
stripScripts()Strips a string of anything that looks like an HTML script block.
stripTags()Strips a string of any HTML tag.
sub()Returns a string with the first count occurrences of pattern replaced by either a regular string, the returned value of a function or a Template string.
succ()Used internally by ObjectRange. Converts the last character of the string to the following character in the Unicode alphabet.
times()Concatenates the string count times.
toArray()Splits the string character-by-character and returns an array with the result.
toJSON()Returns a JSON string.
toQueryParams()Parses a URI-like query string and returns an object composed of parameter/value pairs.
truncate()Truncates a string to the given length and appends a suffix to it (indicating that it is only an excerpt).
underscore()Converts a camelized string into a series of words separated by an underscore ("_").
unescapeHTML()Strips tags and converts the entity forms of special HTML characters to their normal form.
unfilterJSON ()Strips comment delimiters around Ajax JSON or JavaScript responses. This security method is called internally.

转载于:https://my.oschina.net/prototype1/blog/71347

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/403807.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

vue-cookies使用方法,vue中使用获取cookie

1.安装vue-cookies npm install vue-cookies -S2.在main.js引入 import VueCookies from "vue-cookies";Vue.use(VueCookies);如图: 3.在vue组件中使用(如果存入的是对象,需要先转换为json字符串) 设置cookies this.$cookies.set(fileIn…

认识repo

任何一个学习Android开发的开发者如果想要深入学习Android,一定要看Android源码,网上关于下载Android源码的教程有很多,如果你已经翻墙了,你可以直接参考Google官网的教程或者老罗最新出的教程,如果你还没有翻墙&#…

python多线程编程(6): 队列同步

From: http://www.cnblogs.com/holbrook/archive/2012/03/15/2398060.html 前面介绍了互斥锁和条件变量解决线程间的同步问题,并使用条件变量同步机制解决了生产者与消费者问题。 让我们考虑更复杂的一种场景:产品是各不相同的。这时只记录一个数量就不…

ecshop在PHP 5.4以上版本各种错误问题处理

在php5.4版本之后有很多的函数与功能进行丢弃与升级功能了,现在国内很多CMS都还未按php5.4标准来做了,下面我整理了一些在ecshop在PHP 5.4以上版本各种错误问题处理. 1、PHP 5.4.X环境下安装ECShop出现“includes/cls_template.php on line 406…

【SRX】折腾了半天终于我的那对SRX210 升级到了 12.1R1.9

SRX brach产品一般 唯一的好处就是 学习机中的战斗机 安全特性 路由 MPLS VPLS 全方位支持 最近可以研究一下 和Zebos 的互通 改改Zebos 7.9.1的code转载于:https://www.cnblogs.com/abacuspix/archive/2012/08/07/2627364.html

BOM中的那点事-location

现在来了解一下JavaScript中的location对象。location记录了页面文档的位置信息,当然这个位置不是地址位置,而是指web中的文档位置。location其实是一个很特殊的对象,首先它是window的属性,同时也是document的属性,换句…

python多线程编程(7):线程间通信

From: http://www.cnblogs.com/holbrook/archive/2012/03/21/2409031.html 很多时候,线程之间会有互相通信的需要。常见的情形是次要线程为主要线程执行特定的任务,在执行过程中需要不断报告执行的进度情况。前面的条件变量同步已经涉及到了线程间的通…

vue本地下载文件,解决ie浏览器本地下载文件无反应(已解决);vue-cli2本地下载文件,vue-cli3本地下载文件

1.vue-cli2vue 注意&#xff1a;vue-cli2本地文件需要放在静态文件static下<a href"javascript:void(0);" click"download">帮助文档</a>download(){axios.get(static/export.pdf, {responseType: blob, //重要}).then(response > {//判断…

CSS position 笔记+实验

目录&#xff1a;1.static2.relative3.absolute4.fixed5.实验&#xff1a;static, relative, absolute中&#xff0c;父元素-子元素高度关系6.z-index7.参考资料1.static默认的定位方式&#xff0c;不支持设置位移属性用来覆盖之前创建的 absolute, relative, fixed 2.relative…

Linux 查找指定文件并删除

find . -name *.png | xargs rm -fr

python多线程编程(8):线程的合并和后台线程

From: http://www.cnblogs.com/holbrook/archive/2012/03/21/2410120.html 线程的合并 python的Thread类中还提供了join()方法&#xff0c;使得一个线程可以等待另一个线程执行结束后再继续运行。这个方法还可以设定一个timeout参数&#xff0c;避免无休止的等待。因为两个线…

修改ant design vue中的Icon图标颜色

直接行内式即可 <a-icon type"file-text" style"color: rgba(28, 106, 235, 1)" />

学习进度条10

学习进度条 第 十一 周 星期一 星期二 星 期 三 星期四 星期五 星期六 所花时间 90 100 50 42 代码量 0 120 博客量 1 1 1 了解到的知识点 初次了解到典型用户和场景 进行对自己模块设定典型用例 复习了…

批量同时创建邮箱和AD账户

前面我写了关于批量创建AD账户的BLOG,http://mcmvp.blog.51cto.com/5497438/959289也写了用UI批量启用邮件的方法&#xff0c;http://mcmvp.blog.51cto.com/5497438/959314但是这还是要执行两步&#xff0c;我们能不能只要执行一下&#xff0c;AD账户建立成功&#xff0c;邮箱跟…

I/O多路转换 select

Linux驱动部分我们曾经使用了poll机制完成了在应用层代码读取按键值。这节课介绍的select也很相似。当我们要监控好几个文件描述符的读写呢&#xff1f;如果我们阻塞的去处理其中一个&#xff0c;那第二个怎么办呢&#xff1f;下面我们一起想想办法。 方法一&#xff1a;使用fo…

Python使用select实现异步通信

From: http://www.linuxidc.com/Linux/2014-02/97152.htm 当一个服务器需要与多个客户端进行通信时&#xff0c;可以使用多进程或者多线程的服务器&#xff0c;也可以使用select模块&#xff0c;它可以实现异步通信。Python中的select模块包含了poll()和select(),select的原型…

ant design vue中通知提醒框Notification的使用

效果&#xff1a;点击接口&#xff0c;出现提示弹框&#xff0c;数据获取到后在消失 <template><a-button type"primary" click"openNotification">Open the notification box</a-button> </template> <script> const clo…

Cocos2d-3.x目录介绍分析

一、下载cocos2d的框架 1.下载地址&#xff1a;http://www.cocos2d-x.org/download/version#Cocos2d-x 我们还是选择v3.11吧 比较新的框架 2.下载之后解压这个文件夹就可以了 cocos2d-x-3.11.zip这使我们下载的文件 解压之后&#xff1a; 3. 文件夹目录如图 接下来我们逐步来介…