View Single Post
Old 12-29-2012, 12:40 AM   PM User | #7
rich1051414
New to the CF scene

 
Join Date: Dec 2012
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
rich1051414 is an unknown quantity at this point
Quote:
Originally Posted by bullet1 View Post
Code:
String items = _perso.getItemsIDSplitByChar(";"); // it's the function that take the value of the field and separate the IDS by ";"
                                                    	String[] item = items.split(";");
                                                    	String id = "141375";
                                                    	for (int i = 0; i < item.length; i++)
                                                    	{
                                                    		if (item[i] != null && item[i].equals(id)) {
                                                    			SocketManager.GAME_SEND_MESSAGE(_perso, "You have the item", Ancestra.COLOR_BLEU2);
                                                    			break;
                                                    		}
                                                    		else
                                                    		{
                                                    			SocketManager.GAME_SEND_MESSAGE(_perso, "You don't have the item", Ancestra.COLOR_ERROR);
                                                    			break;
                                                    		}
I doesn't work :/
Split uses regex, not literal strings, try this:
.split("[; ]")
rich1051414 is offline   Reply With Quote