View Full Version : illegal character filter
DannyBoy3 03-06-2012, 07:07 AM What's the easiest way to ensure a user doesn't place any illegal characters in a filename?
Thnx
|
|
there are many ways to go about this. Here is one:
fn validateFilename f =
(
for c in ((dotnetclass "System.IO.Path").GetInvalidFileNameChars()) do f = substituteString f c "_"
f
)
denisT
03-06-2012, 08:54 AM
if i need just to check that user doesn't type illegal characters i would do it with regex:
http://stackoverflow.com/questions/62771/how-check-if-given-string-is-legal-allowed-file-name-under-windows
CGTalk Moderation
03-06-2012, 08:54 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
vBulletin v3.0.5, Copyright ©2000-2013, Jelsoft Enterprises Ltd.