i have an String and i need to split this String to array My String is for example "-2x+3"
i split it with this code
public static String[] splitAnswer(String answerInput){
answerInput = answerInput.trim();
String[] token = answerInput.split("[\\+\\-\\*\\\\\\/]");
return token;
}
but i need the minus sign with 2x i.e. (-2x) and my array output will be {"-2x","3"}
the important thing i need the minus with the number after