chars are missing in filter method

chars are missing in filter method

Post by Carramb » Fri, 06 May 2005 05:41:36


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 filtreraStrg( String inmatning ) {
char slash = '/';
char backslash = '\\';
int rnaTecken = 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( rnaTecken++, 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.