CSharpTest.Net
AlphaNumericOnly Method
See Also  Example Send Feedback Download Help File
CSharpTest.Net.Library Assembly > CSharpTest.Net.Utils Namespace > StringUtils Class : AlphaNumericOnly Method

input

Glossary Item Box

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
C# 
public static string AlphaNumericOnly( 
   string input
)

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.NETCopy 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

Generated with Document! X 2011 by Innovasys