• 小程序 ----- js常用方法


    1、 length 获取字符串长度,从0 开始

    let filePathNameLenght = filePathName.length;
    console.log(filePathNameLenght)

    2、 lastIndexOf () 获取最后一个字符串所在长度,从0 开始

        let filePathNameHZ = filePathName.lastIndexOf('.')
        console.log(filePathNameHZ)

    3、substring()  截取指定位置的字符串,从0 开始

        let houZhui =  filePathName.substring(filePathNameHZ+1)
        console.log(houZhui)

    4、 将字符串转化为大写 或小写

    toLocaleUpperCase() :将字符串转换为大写
    toLocaleLowerCase() :将字符串转换为小写

    5、indexOf () : 返回字符串所在索引,没有返回 -1

    6、replace() : 将字符串中用一些字符替换另一些字符,或替换一个与正则表达式匹配的子串

    7、split() : 将一个字符串分割成字符串数组

  • 相关阅读:
    cannot resolve symbol 'XXX'
    jwt单点登入
    空3
    Hibernate持久化,生命周期
    Hibernate主键生成策略
    Hibernate常用api以及增删改查
    Hibernate配置流程
    Hibernate定义
    Git总结
    spring整合MQ
  • 原文地址:https://www.cnblogs.com/obge/p/13890284.html
Copyright © 2020-2023  润新知