I want to remove the non-printable character only for the String fields in the poject, I know we can use
public String removeNonPrintable(String field) {
return field.replaceAll("[^A-Za-z0-9]", "");
}
to remove the non-printable characters from string.
But I want to have the generic method like:
public <T> T removeNonPrintable(Class<T> myClassObject) {
/// Get only the string and remove non-printable code stuffs
return removedNonPrintableCharactersmyClassObject;
}
Can anyone please help me to do it?
This question may be duplicate, but I failed to found the exact solutions for it.