限制文本输入字段中的字符集
我有一个 TextInput 字段,应限制为大写字母、小写字母、数字和下划线。这是我试图用来限制字符的代码:
restrict="\\A-Z\\a-z\\0-9\\ \\_\\-"
我正在为这个 Textinput 组件使用 MXML。
不幸的是,这并没有限制 \ 字符,这是我想限制的最后一个字符。
如何将反斜杠添加到受限字符列表中?
谢谢
斯蒂芬
I have a TextInput field that should be restricted to either capital letters, lowercase letters, numbers and underscores. This is the code I'm trying to use to restrict characters:
restrict="\\A-Z\\a-z\\0-9\\ \\_\\-"
I'm using MXML for this Textinput component.
Unfortunately this does not restrict the \ character, which is the last character I'd like to restrict.
How can I add the backslash to the list of restricted characters?
Thanks
Stephen
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
实际上找到了解决方案,我已将限制代码修改为:
restrict="A-Za-z0-9 _\-"
我取出了我认为或正在用作分隔符的所有反斜杠。
现在工作正常。
Actually found the solution I've amended the restrict code to:
restrict="A-Za-z0-9 _\-"
I took out all the back slashes which I thought or was using as delimiters.
Works fine now.