【system.string】使用说明
对象:system.string
说明:提供一系列针对字符串类型的操作
目录:
方法:
原型:system.string.isBlank( string )
说明:检测参数string是否是空字符
返回:[True | False]
原型:system.string.trim( string )
说明:去除参数string两侧的空白符
返回:[String]
原型:system.string.clearLeftChar(string, char)
说明:去除参数string左侧指定的字符串
返回:[String]
原型:system.string.clearRightChar(string, char)
说明:去除参数string右侧指定的字符串
返回:[String]
原型:system.string.clearBothChar(string, char)
说明:去除参数string两侧指定的字符串
返回:[String]
原型:system.string.clearBlankLine( string )
说明:去除参数string内的空行
返回:[String]
原型:system.string.rndChar( minLength, maxLength )
说明:输出随机字符
返回:[String]
参数:
minLength [Number 必需] 最少输出字符长度
maxLength [Number 可选] 最多输出字符长度 注意:
system.string.rndChar( 10 ) '表示随机输出10个字符
system.string.rndChar( 4, 20) '表示随机输出4至20个字符
原型:system.string.cutStr( string, cutLen, suffix)
说明:截取字符串指定长度部份
返回:[String]
参数:
string [String 必需] 待截取的字符串
cutLen [Number 必需] 截取长度
suffix [String 可选]后缀字符,默认值为 ... 注意:
截取长度超出字符串长度时,无后缀。
原型:system.string.replace( string, replaceString, newString, ignoreCaseg )
说明:替换字符串中指定的字符串。
返回:[String]
参数:
string [String 必需] 字符串
replaceString [String 必需] 要替换的字符串
newString [String 必需] 替换的新值
ignoreCaseg [Boolean 可选] 是否忽略大小写,默认值true
原型:system.string.split( string, splitString, ignoreCaseg )
说明:将字符串按指定的字符分割成数组。
返回:[Array]
参数:
string [String 必需] 字符串
splitString[String 必需] 分割的字符串
ignoreCaseg [Boolean 可选] 是否忽略大小写,默认值true
原型:system.string.inStr( string1, string2, ignoreCaseg )
说明:字符串2在字符串1内首次出现的位置
返回:[Number]
参数:
string [String 必需] 字符串
splitString[String 必需] 分割的字符串
ignoreCaseg [Boolean 可选] 是否忽略大小写,默认值true
原型:system.string.mid( string, startPosition, length )
说明:取出指定位置、指定长度的字符串
返回:[String]
参数:
string [String 必需] 字符串
startPosition [Number 必需] 起始位置,位置从1开始。
length [Number 可选] 取出字符长度,不设置时表示取出到结尾
原型:system.string.range(string, array)
说明:字符串string是否在指定的区间内(严格匹配:区分大小写、不过滤空格)
返回: [True | False]
参数:
string [必须 string] 字符串
array [必须 Number] 数组
原型:system.string.toLowerCase( string )
说明:将字符串全部转换成小写
返回:[String]
参数:
string [String 必需] 字符串
原型:system.string.toUpperCase( string )
说明:将字符串全部转换成大写
返回:[String]
参数:
string [String 必需] 字符串
原型:system.string.reverse( string )
说明:反转字符串
返回:[String]
参数:
string [String 必需] 字符串
原型:system.string.hexToOct( hexStr )
说明:十六进制转换成十进制, 格式如: FFC0
返回:[String]
参数:
hexStr [必需 String] 十六进制字符串
原型:system.string.toHex( string )
说明: 将字符串变成十六进制格式类似ueltraedut显示结果,比如 "abc" 输出结果: "61 62 63"
返回:[String]
参数:
string [必须 String]
示例:
system.string.toHex("abc") 结果 61 62 63
原型:system.string.filterHtml( string )
说明:过滤掉HTML内的<>部份,并去掉 换行、空格,制表,常用于提取文章内的正文内容
返回:[String]
参数:
string [必需 String]
原型:system.string.filterJs( string )
说明:过滤HTML代码内的JS脚本
返回:[String]
参数:
string [必需 String]
原型:system.string.htmlEncode( string )
说明:重定义Server.HTMLEncode,因为 server.htmlencode(Null)时出错,所以建议使用 htmlEnCode
返回:[String]
参数:
string [必需 String]
原型:system.string.safeHtml( string )
说明:输出安全的html代码
返回:[String]
参数:
string [必需 string]
原型:system.string.ascii( string )
说明:将字符串组合成acsii码用于安全输出内容,转换结果以&#开头,格式为:中国a.....
返回:[string]
参数:
string [必须 string]
原型:system.string.escape( string )
说明:js版的escape处理字符, 将特殊字符转换,结果以%开始,比如将 \ 转换成 %5,比较适用于URL
返回:[string]
参数:
string [必需 string]
原型:system.string.sha1( string )
说明:字符串的sha1加密,尽量不要使用汉字!
返回:[string]
参数:
string [必需 string]
原型:system.string.md5( string, bit )
说明:将字符串MD5加密
返回:[string]
参数:
string [必须 string] 字符串
bit [可选 32|64] 默认采用32位加密
【system.string】使用说明的更多相关文章
- mvc ef LINQ to Entities 不识别方法“Int32 Parse(System.String)”,因此该方法无法转换为存储表达式。
private sys_User GetUserInfo() { sys_User model = null; var userId = Convert.ToInt32(AccountHelper.G ...
- 問題排查:类型“System.DateTime”的对象无法转换为类型“System.String”
最近在擴充資料對接工具的功能 經常會遇到這個狀況 當然還有其他同類提示,例如 int/decimal 無法轉 System.String 等等 無獨有偶 這些錯誤幾乎都是在 DataTable 轉換成 ...
- C# 对包含文件或目录路径信息的 System.String 实例执行操作
在字符串操作中有一类比较特殊的操作,就是对包含文件或目录路径信息的 System.String 实例执行操作.比如根据一个表示路径的字符串获取其代表的文件名称.文件夹路径.文件扩展名等.在很多时候,我 ...
- LINQ to Entities 不识别方法“System.String ToString()”,因此该方法无法转换为存储表达式。
var data = DataSource.Skip(iDisplayStart).Take(iDisplayLength).Select(o => new { MatNR = o.MatNR, ...
- 类库探源——System.String
一.MSDN描述 String 类: 表示文本,即一系列的 Unicode 字符 命名空间 : System 程序集 : mscorlib.dll 继承关系: 备注: 1. 字符串是 Unicode ...
- Linq中字段数据类型转换问题(Linq to entity,LINQ to Entities 不识别方法"System.String ToString()"问题解决)
1.在工作中碰到这样一个问题: 使用linq时,需要查询两个表,在这两张表中关联字段分别是int,和varchar()也就是string,在linq中对这两个字段进行关联, 如果强制类型转换两个不同类 ...
- Web Service接口返回泛型的问题(System.InvalidCastException: 无法将类型为“System.Collections.Generic.List`1[System.String]”的对象强制转换为类型“System.String[]”)
在使用C#写Web Service时遇到了个很奇怪的问题.返回值的类型是泛型(我用的是类似List<string>)的接口,测试时发现总是报什么无法转换为对象的错误,百思不得其解. 后来在 ...
- 无法将类型为“System.DBNull”的对象强制转换为类型“System.String”
在ERP中做业务类单据,有时候会遇到这样的报错. 无法将类型为"System.DBNull"的对象强制转换为类型"System.String" 去数据库中检 ...
- LINQ to Entities 不识别方法“System.String get_Item(Int32)”,因此该方法无法转换为存储表达式。
1.LINQ to Entities 不识别方法“System.String get_Item(Int32)”,因此该方法无法转换为存储表达式.项目中发现linq to entities 不识别? , ...
随机推荐
- PAT——1064. 朋友数(set用法)
如果两个整数各位数字的和是一样的,则被称为是“朋友数”,而那个公共的和就是它们的“朋友证号”.例如123和51就是朋友数,因为1+2+3 = 5+1 = 6,而6就是它们的朋友证号.给定一些整数,要求 ...
- HDU 2097 sky数 (进制转化)
传送门: Sky数 Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total S ...
- Network Security Threats
Network Security Combination of low-cost powerful computing and high-performance networks is a two-e ...
- Gradle Goodness: Running Java Applications from External Dependency
With Gradle we can execute Java applications using the JavaExec task or the javaexec() method. If we ...
- 10.vue router 带参数跳转
vue router 带参数跳转 发送:this.$router.push({path:'/news',query:{id:row.id}}) 接收:var id=this.$route.query. ...
- Web—03-神器Photoshop
常用图片格式 1.psd photoshop的专用格式. 优点:完整保存图像的信息,包括未压缩的图像数据.图层.透明等信息,方便图像的编辑. 缺点:应用范围窄,图片容量相对比较大. 2.jpg 网页制 ...
- Inconsistant light map between PC and Mobile under Unity3D
Author: http://www.cnblogs.com/open-coder/p/3898159.html The light mapping effects between PC and Mo ...
- springsource-tool-suite插件下载
下载地址: https://spring.io/tools3/sts/all/ 下载页面上的 update sites archives文件
- 一个hibernate中的异常:NonUniqueDiscoveredSqlAliasException
在hibernate中用SQL查询返回的结果集中,列名或别名必须唯一,否则会报下面的错误.返回的结果集中,列名或别名可以没有,但只能有一列没有. //空别名重复的情况:org.hibernate.lo ...
- webuploader的一个页面多个上传按钮实例
借鉴一位大佬的demo 附上他的github地址https://github.com/lishuqi 我把他的cxuploader.js改了不需要预览 直接上传图片后拿到回传地址给img标签显示图 ...