且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

什么是“分裂”方法在java中的问题?!

更新时间:2023-02-26 20:17:29

^是一个特殊字符。您需要使用\\ ^


来转义它

hey . i am using "Split" method but i have a problem . when i use a "^" character as a boundary between my words it cant separate them ! but if i use "/" instead , it works very well ! what is it's problem ?!
its my code with "/" : it works well !

String serverResponsesArray[]=new String [3];
serverResponsesArray=Data.split("/",3);



now if i change "/" to "^" it doesnt work !

String serverResponsesArray[]=new String [3];
serverResponsesArray=Data.split("^",3);

The ^ is a special character. You will need to escape it with "\\^"