如何检查字符串是否以特定子字符串结尾?
是否有冷融合字符串函数来检查一个字符串是否以另一个字符串结尾?如果没有,实现这一目标最简单、最有效的方法是什么?
Is there a coldfusion string function to check if a string ends with another string? If not, what is the simplest and most efficient way to accomplish this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您可以使用
right(string, numberofcharacters)
函数。示例(cf脚本):
You can use the
right(string, numberofcharacters)
function.example (cfscript):
这是我快速跳到 java 级别的地方。
这应该输出 TRUE
这里有更多详细信息:
http:// download.oracle.com/javase/6/docs/api/java/lang/String.html#endsWith(java.lang.String)
请注意,endsWith() 区分大小写。
要解决这个问题,请使用 LCase() 或 UCase(),例如
也应该返回 TRUE
This is where I skip down to the java level real fast.
This should output TRUE
More details here:
http://download.oracle.com/javase/6/docs/api/java/lang/String.html#endsWith(java.lang.String)
Note that endsWith() is case sensitive.
To get around this, use LCase() or UCase(), e.g.
Should also return TRUE
我找到的解决方案( http://tutorial130.easycfm.com/ ) -
使用正则表达式 find -
REFindNoCase
,并用$
符号表示字符串的结尾。A solution that I found ( http://tutorial130.easycfm.com/ ) -
Use a regular expression find -
REFindNoCase
, with a$
sign to represent the end of the string.