T
Tom Gur
Hi,
I need to strip all of the pipe-characters of a string. normally I
would use something like:
str.replaceAll("the-char-i-want-to-replace", "");
But from some reason: str.replaceAll("|", "") do not alter the string.
currently I've wrote something like that:
private static String strip_for_validation(String str) {
return str.lastIndexOf('|') == -1 ? str.replaceAll(" ", "") :
strip_for_validation(str.substring(0,str.lastIndexOf('|')) +
str.substring(str.lastIndexOf('|')+1));
}
But is there any alteration I can make in order to use the much more
readable replaceAll method ?
I need to strip all of the pipe-characters of a string. normally I
would use something like:
str.replaceAll("the-char-i-want-to-replace", "");
But from some reason: str.replaceAll("|", "") do not alter the string.
currently I've wrote something like that:
private static String strip_for_validation(String str) {
return str.lastIndexOf('|') == -1 ? str.replaceAll(" ", "") :
strip_for_validation(str.substring(0,str.lastIndexOf('|')) +
str.substring(str.lastIndexOf('|')+1));
}
But is there any alteration I can make in order to use the much more
readable replaceAll method ?