如何限制方括号. [英] how to restrict the square brackets.

查看:89
本文介绍了如何限制方括号.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经限制了文本输入中的特殊字符,但是它被接受了方括号,我如何才能限制文本输入中的方括号..谢谢您.

i have restricted the special characters in text input but it is accepted the square brackets, how can i restrict the square brackets in text input..Thanks in Advance.

推荐答案

您的意思是"["和]"?

整理出来.

Java.lang.String [ ^ ]包含用于

- String.indexOf(字符串) [ String.replaceAll(String,String) [
You mean "[" and "]" ??

Sort them out.

the class Java.lang.String[^] contains methods for

- String.indexOf(String)[^] which returns a positive natural number if it found some or -1 when not.

- String.replaceAll(String, String)[^] to replace a certain expression in a String.

Be aware that those functions return the new formatted String.


这篇关于如何限制方括号.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆