CloudPT Posted February 19, 2012 at 04:43 PM Report Share #440332 Posted February 19, 2012 at 04:43 PM Boas pessoal, Tenho uma pequena duvida em relação a um método em java static void removeLetters( BufferedReader orders, BufferedReader in, BufferedWriter out) throws IOException . Este método é suposto percorrer um .txt (in) e verificar os caracteres no txt orders e escrever em outro txt sem os caracteres no orders. Por exemplo no txt in "Hello World" txt orders "Ho" txt out " ell Wrld" (final) Eu tenho este codigo String line; char[] ords = new char[quantos+1]; // vector do txt orders while((line = in.readLine())!= null){ } } A minha duvida é qual a melhor forma de apagar esses caracteres. Já pesquisei no api do java mas não consegui. :S Link to comment Share on other sites More sharing options...
HappyHippyHippo Posted February 19, 2012 at 06:55 PM Report Share #440348 Posted February 19, 2012 at 06:55 PM - criar um buffer auxiliar - verificar caracter a caracter - se ele não fizer parte do conjunto de caracteres a descartar - copiar para o buffer auxiliar - retornar o buffer auxiliar IRC : sim, é algo que ainda existe >> #p@p Portugol Plus Link to comment Share on other sites More sharing options...
CloudPT Posted February 19, 2012 at 07:13 PM Author Report Share #440353 Posted February 19, 2012 at 07:13 PM criei este pedaço de código que vai transformar a string em array char String str = "Abcdefg"; char[] cArray = str.toCharArray(); for (char c : cArray) System.out.println(c); agora só me falta retirar mas, não estou a ver como. :S Link to comment Share on other sites More sharing options...
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