开发者

clear string from signs which cant be used in filename

Im generating various strings 开发者_如何学Goand then I want to save files with generated strings as filenames. Sometimes generated string has got various chars which arent allowed to use in filename.

Is there any ready to use class or sth which can clean up string from such characters ?


Have a look at

Path.GetInvalidPathChars() and Path.GetInvalidFileNameChars()


You can can the list of invalid characters from the Path class - specifically the GetInvalidFileNameChars and GetInvalidPathChars methods.

You can use these in conjunction with the different string methods to cleanup the string.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜