<html>
<body> <script type="text/javascript">
var str="ab:cd:ef:gh"
var txt="Hello World!"
document.write(txt.length)
document.write("<p>Big: " + txt.big().big().big() + "</p>")
document.write("<p>Small: " + txt.small() + "</p>")//设置字体大一号或者小一号 document.write("<p>Bold: " + txt.bold() + "</p>")
document.write("<p>Italic: " + txt.italics() + "</p>")//设置字体斜体或粗体 document.write("<p>Strike: " + txt.strike() + "</p>")//文字被杠掉,删除线 document.write("<p>Fontcolor: " +txt.fontcolor("Red") + "</p>")
document.write("<p>Fontsize: " + txt.fontsize(30) + "</p>")//设置字体颜色和大小 document.write("<p>Lowercase: " + txt.toLowerCase() + "</p>")
document.write("<p>Uppercase: " + txt.toUpperCase() + "</p>")//大小写转换 document.write(txt.replace(/World/,"Wow"))//替换文字 document.write(txt.indexOf("Hello") + "<br />")//0
document.write(txt.indexOf("World") + "<br />")//6
document.write(txt.indexOf("world"))//-1查询文本第一次出现的位置,如果没有的话,就返回-1 document.write(txt.match("Hello") + "<br />")//查找字符串中的字符,若有则返回字符
document.write(txt.match("World") + "<br />")//
document.write(txt.match("world") + "<br />")//没有的话则返回null document.write(txt.substr(3) + "<br />")//从3为下标截取到结束
document.write(txt.substr(3,5) + "<br />")//从3为下标截取5个字符 document.write(txt.substring(3) + "<br />")//从3为下标截取到结束
document.write(txt.substring(3,7) + "<br />")//从3为下标截取到7为下标(不包括7) document.write("<p>Link: " + txt.link("http://www.baidu.com") + "</p>")//给文字添加上超链接
document.write("分隔字符串"+str.split(":"))
document.write("分隔字符串"+txt.split("",3))//返回的数组长度为3
</script> </body>
</html>

javascript (string 部分)的更多相关文章

  1. JavaScript String 对象

    JavaScript String 对象 String 对象 String 对象用于处理文本(字符串). String 对象创建方法: new String(). 语法 var txt = new S ...

  2. javascript string 函数集

    JavaScript_String对象说明 string中文为"字符串"的意思,String继承自Object对象,此对象提供字符串的查找操作等函数 JavaScript字符串类型 ...

  3. 【timeisprecious】【JavaScript 】JavaScript String 对象

    JavaScript>String 对象 1 .From Runnob JavaScript String 对象(概览) JavaScript String 对象(教程)

  4. JavaScript String 小球重力弹回

    JavaScript String 小球重力弹回 <!DOCTYPE html> <html lang="en"> <head> <met ...

  5. JavaScript String 字符串方法

    JavaScript String 字符串方法汇总   1.str.indexOf() 方法查找字符串中的字符串  返回   字符串中指定文本首次出现的索引(位置)       JavaScript ...

  6. 浏览器端-W3School-JavaScript:JavaScript String 对象

    ylbtech-浏览器端-W3School-JavaScript:JavaScript String 对象 1.返回顶部 1. JavaScript String 对象 String 对象 Strin ...

  7. JavaScript string repeat methods All In One

    JavaScript string repeat methods All In One There are many ways in the ES-Next ways repeat ES2015 / ...

  8. HTML 学习笔记 JavaScript (String)

    String对象用于存储字符串的数据.这里我们做了JavaScript的String字符串对象常用操作总结. 创建String对象的方式 声明:String 对象的方法也可以在所有基本字符串值中访问到 ...

  9. JavaScript string.format

    //string.format String.prototype.format=function(){ var e = this, f = arguments.length; if (f > 0 ...

  10. javascript String 和StringBuffer 的应用

    显示情况时Javascript中并没有StringBuffer类,一种主流的Javascript StringBuffer类的实现是通过prototype构造一个StringBuffer类. Stri ...

随机推荐

  1. 如何学习Javascript ?

    先说说学js的条件 论条件,咱是文科生,大学专业工商管理,和计算机毛关系都没:有人说英语,读了四年大学,很遗憾,咱还四级没混过:就咱这条件都学得乐呵呵的,您还等啥.当然学习JS也是有门槛的,就是你的h ...

  2. apache域名重定向301跳转 .htaccess的写法

    RewriteEngine on RewriteBase / RewriteCond %{HTTP_HOST} ^baidu.com$ [NC] RewriteRule ^(.*)$ http://w ...

  3. [LeetCode]题解(python):006-ZigZag Conversion

    题目来源: https://leetcode.com/problems/zigzag-conversion/ 题意分析: 这道题目是字符串处理的题目.输入一个字符串和一个数字,将字符串填入倒Z形输入字 ...

  4. objectiveC获取本地时间。

    NSDate * date = [NSCalendarDate date]; NSLog(@"%@", date); 日历在IOS里报错,,. NSDateFormatter *f ...

  5. golang并发编程

    golang并发编程 引子 golang提供了goroutine快速实现并发编程,在实际环境中,如果goroutine中的代码要消耗大量资源时(CPU.内存.带宽等),我们就需要对程序限速,以防止go ...

  6. spring学习总结(mybatis,事务,测试JUnit4,日志log4j&slf4j,定时任务quartz&spring-task,jetty,Restful-jersey等)

    在实战中学习,模仿博客园的部分功能.包括用户的注册,登陆:发表新随笔,阅读随笔:发表评论,以及定时任务等.Entity层设计3张表,分别为user表(用户),essay表(随笔)以及comment表( ...

  7. 卡特兰数(Catalan)简介

    Catalan序列是一个整数序列,其通项公式是 h(n)=C(2n,n)/(n+1) (n=0,1,2,...) 其前几项为 : 1, 1, 2, 5, 14, 42, 132, 429, 1430, ...

  8. Mobile上的viewport及各种概念澄清贴

    device Pixel & CSS Pixel 物理像素指显示设备上的物理像素点,比如HTC G11宽是480px,这的480是用物理像素衡量的. CSS像素的话则指我们写页面时理解的那个像 ...

  9. JAVA的IO学习

    IO 有具体的分类: 有具体的分类:1:根据处理的数类型不同:字节流和字符流.2:根据流向不同:输入流和输出流. =============(补充字节跟字符概念区分)================= ...

  10. Intersection(poj)

    Intersection Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 13140   Accepted: 3424 Des ...