The key to your question is the phrase "remove characters that are not valid for the platform." Various String to Path conversion functions, such as get() and resolve() , will tell you if the string was valid as a path, but it will not indicate why it is not valid. One way to be invalid is to contain invalid characters. Another would be, say, too many slash characters. Despite this, the library does not provide more information than this; it does not provide an opportunity to assist in verifying user input in any way that will help the user correct an input error. Admittedly, this should be standard practice, but it is hardly a practice at all.
Upshot: you will need to write such a validation library yourself if you want to use it. Potential: Of course, you are not the only person with such a problem.
source share