Visual Basic (Declaration) | |
---|---|
Public Shared Function SafeFileName( _ ByVal name As String _ ) As String |
Parameters
- name
- The text to parse
Return Value
The text provided with only allowable charactersLibrary/Library.Test/TestStringUtils.cs
C# | Copy Code |
---|---|
Assert.AreEqual(null, StringUtils.SafeFileName(null)); Assert.AreEqual("--------------", StringUtils.SafeFileName("\b\t\r\n/\\:*?\"'<>|")); Assert.AreEqual("Greetings this is !@#)%~^@+)(", StringUtils.SafeFileName("Greetings this is !@#)%~^@+)(")); Assert.AreEqual("-ca761232-ed42-11ce-bacd-00aa0057b223-", StringUtils.SafeFileName("<ca761232|ed42|11ce|bacd|00aa0057b223>")); |
VB.NET | Copy Code |
---|---|
Assert.AreEqual(Nothing, StringUtils.SafeFileName(Nothing)) Assert.AreEqual("--------------", StringUtils.SafeFileName(vbBack & vbTab & vbCr & vbLf & "/\:*?""'<>|")) Assert.AreEqual("Greetings this is !@#)%~^@+)(", StringUtils.SafeFileName("Greetings this is !@#)%~^@+)(")) Assert.AreEqual("-ca761232-ed42-11ce-bacd-00aa0057b223-", StringUtils.SafeFileName("<ca761232|ed42|11ce|bacd|00aa0057b223>")) |
Target Platforms: Windows XP, Windows Server 2003, Windows Vista, Windows Server 2008, Windows 7
Reference
StringUtils ClassStringUtils Members
Used By
Boolean RegistryStorage.Read(String,String,String)RegistryStorage.Write(String,String,String)
RegistryStorage.Delete(String,String)
Boolean IsolatedStorage.Read(String,String,String)
IsolatedStorage.Write(String,String,String)
IsolatedStorage.Delete(String,String)
Boolean FileStorage.Read(String,String,String)
FileStorage.Write(String,String,String)
FileStorage.Delete(String,String)
String StringUtils.SafeFilePath(String)