chars are missing in filter funktion

C

Carramba

Hi!

I have this filter method, but by some reason char are misstiriosly
dissapiering, I have tryed to use println for debugging, but I can't find
whats wrong with it.


public static String filtreraSträng( String inmatning ) {
char slash = '/';
char backslash = '\\';
int räknaTecken = 0;

StringBuffer renad = new StringBuffer( inmatning.length() );
renad.setLength( inmatning.length() );
for ( int i = 0; i < inmatning.length(); i ++ ) {
char justNu = inmatning.charAt(i);
if ( justNu == slash || justNu == backslash )
renad.setCharAt( räknaTecken++, justNu );
}
return renad.toString().trim();
}

--

Thanx in advance
________________________
BTW. I know my english is not best in the word, so please stop bugging me
about my speling. And yes Iam sorry you don't understand what I mean, but
there is no point to yell at me. Have a nice day.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,682
Members
48,796
Latest member
Greg L.

Latest Threads

Top