UtterAccess HomeUtterAccess Wiki

Welcome Guest ( Log In | Register )

Custom Search
Edit Discussion
> GetAlphaOnly    

Returns only Alphabetical characters from a string.

Related Functions: GetDigitsOnly and Strip Illegal Characters

CODE
' Code courtesy of UtterAccess Wiki
' http://www.utteraccess.com/wiki/index.php/Category:FunctionLibrary
' Original submission by Walter Niesz
' September 7, 2010

' DESCRIPTION
' This function accepts any string of characters
' and returns only letters of the alphabet.

Const AllLetters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"

Public Function GetAlphaOnly(InputString As String) As String

   Dim i As Long
   
   For i = 1 To Len(InputString)
       If InStr(AllLetters, Mid(InputString, i, 1)) > 0 Then
           GetAlphaOnly = GetAlphaOnly & Mid(InputString, i, 1)
       End If
   Next i
 
End Function


Creative Commons License
GetAlphaOnly by UtterAccess Wiki is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.
Editing and revision of the content is freely encouraged; for details, see Expected Usage.

Edit Discussion
Custom Search
Thank you for your support!
This page has been accessed 4,675 times.  This page was last modified 09:34, 6 April 2011 by Jack Leach. Contributions by Walter Niesz  Disclaimers