zoukankan      html  css  js  c++  java
  • js 大小写转换

    今天在做一个身份证验证的时候遇到的一个小问题,前端正则验证用的 这里 的方法,身份证号最后以为为字母的时候是不区分大小写都可以通过验证的,但是后台程序那边的验证方法则不然,只有大写的时候才通过验证。然后就想到在将身份证号提交到后台的时候统一将字符串转换为大写。这样就可以解决问题了。。。

    toLocaleUpperCase 方法:将字符转换为大写

    stringVar.tolocaleUpperCase();

    必选的 stringVar 引用是一个 String 对象,值或文字。

    //转换成大写
    toUpperCase 方法
    返回一个字符串,该字符串中的所有字母都被转化为大写字母。

    strVariable.toUpperCase( )
    "String Literal".toUpperCase( )

    说明
    toUpperCase 方法对非字母字符不会产生影响。 

    toLocaleLowerCase 方法:将字符转换为小写

    stringVar.tolocaleLowerCase( )

    必选的 stringVar 引用是一个 String 对象,值或文字。

    //转换成小写

    toLowerCase 方法
    返回一个字符串,该字符串中的字母被转换为小写字母。

    strVariable.toLowerCase( )
    "String Literal".toLowerCase( )

    说明
    toLowerCase 方法对非字母字符不会产生影响。 

    高否?富否?帅否? 否? 滚去学习!
  • 相关阅读:
    python note 30 断点续传
    python note 29 线程创建
    python note 28 socketserver
    python note 27 粘包
    python note 26 socket
    python note 25 约束
    Sed 用法
    python note 24 反射
    python note 23 组合
    python note 22 面向对象成员
  • 原文地址:https://www.cnblogs.com/baixc/p/4601122.html
Copyright © 2011-2022 走看看