zoukankan      html  css  js  c++  java
  • 字符串操作

    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>字符串操作</title>
    </head>
    <body>
    
        <script type="text/javascript">
        //声明字符串 
        var str = '@ilove@You@';//
    
        //获取字符串的长度
        var len = str.length;
    
        // /常用的方法
        var res = str.trim('@');
    
        //获取指定索引的字符  $str[]  $str{}
        var res = str.charAt(4);//char字符  at 在...地方
    
        //strpos
        var res = str.indexOf('o');
    
        //strrpos
        var res = str.lastIndexOf('o');
    
        //连接字符串  +  想起arguments
        var res = str.concat('verymuch',' and you???');
    
        //截取字符串
        var res = str.slice(2, 7);
        var res = str.substring(2, 7);
    
        //字符串拆分
        var res = str.split('@');
        // console.log(res);
    
        //截取字符串
        var res = str.substr(2, 4);
    
        //大写转换
        var res = str.toUpperCase();
    
        //小写转换
        var res = str.toLowerCase();
    
        //字符串替换
        var res = str.replace('love','like');
    
        //
        
    
        </script>
    </body>
    </html>
  • 相关阅读:
    CodeForces 404C Ivan and Powers of Two
    CodeForces 433C Ryouko's Memory Note-暴力
    if not
    python3的print函数
    交叉熵
    tensorflow一个很好的博客
    关于第几维的问题
    更新软件
    tensorflow训练代码
    tensorflow的一些函数
  • 原文地址:https://www.cnblogs.com/xujing6/p/6369836.html
Copyright © 2011-2022 走看看