returns a new string containing only the alpha-numeric characters in the original
Syntax
Visual Basic (Declaration) | |
---|
Public Shared Function AlphaNumericOnly( _
ByVal input As String _
) As String |
Parameters
- input
Example
Library/Library.Test/TestStringUtils.cs
C# | Copy Code |
---|
Assert.AreEqual("", StringUtils.AlphaNumericOnly("~!@#$%^&*()_+|}{ "));
Assert.AreEqual("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890",
StringUtils.AlphaNumericOnly("abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ.1234567890"));
Assert.AreEqual("ca761232ed4211cebacd00aa0057b223",
StringUtils.AlphaNumericOnly("{ca761232-ed42-11ce-bacd-00aa0057b223}")); |
VB.NET | Copy Code |
---|
Assert.AreEqual("", StringUtils.AlphaNumericOnly("~!@#$%^&*()_+|}{" & vbTab))
Assert.AreEqual("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890", StringUtils.AlphaNumericOnly("abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ.1234567890"))
Assert.AreEqual("ca761232ed4211cebacd00aa0057b223", StringUtils.AlphaNumericOnly("{ca761232-ed42-11ce-bacd-00aa0057b223}")) |
Requirements
Target Platforms: Windows XP, Windows Server 2003, Windows Vista, Windows Server 2008, Windows 7
See Also