SM Posted November 29, 2012 at 11:10 PM Report #485201 Posted November 29, 2012 at 11:10 PM Boa noite, alguém me sabe dizer como usar o String.split para expressoes que quero partir pelo simbolo=? Basta String.split("=") ou terá de ser String.split("\\=")?
NunoDinis Posted November 29, 2012 at 11:26 PM Report #485203 Posted November 29, 2012 at 11:26 PM Eu uso apenas String.split("#") e estou muito satisfeito com o resultado. Estranha forma de vida que tem a capacidade de transformar comandos em mensagens de erro. ndsotware.org
SM Posted November 29, 2012 at 11:34 PM Author Report #485204 Posted November 29, 2012 at 11:34 PM E isso separa a expressao pelos =?
NunoDinis Posted November 29, 2012 at 11:48 PM Report #485205 Posted November 29, 2012 at 11:48 PM Sim, devolve-te um array de strings. Exemplo : "Portugal=a=programar" , devolve : Portugal a Programar. Estranha forma de vida que tem a capacidade de transformar comandos em mensagens de erro. ndsotware.org
KTachyon Posted November 30, 2012 at 01:27 AM Report #485213 Posted November 30, 2012 at 01:27 AM Não é por nada, mas... demoraste 38 minutos a ter uma resposta à tua pergunta quando podias ter feito um teste simples em 30 segundos: class Untitled { public static void main(String[] args) { String test = "hello=world=!"; String splitted[] = test.split("="); for (String s : splitted) System.out.println(s); } } “There are two ways of constructing a software design: One way is to make it so simple that there are obviously no deficiencies, and the other way is to make it so complicated that there are no obvious deficiencies. The first method is far more difficult.” -- Tony Hoare
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now