Checking strings for letters
I have a String : 2134 CC,
After i read the string, the problem i am trying to slove is how to check the string for any letters, i.e. CC, and if any letters are found, delete them and simply display the numbers i.e. 2134.
Any thoughs or comments would be appreciated
For any string of text or just the string as formatted above?
Try the following Code:
Private Sub Command1_Click()
Dim myStr As String
myStr = "1234 CC"
MsgBox Replace(myStr, "CC", "")
Or for something more widely applicable ....and assuming the appropriate dim's
at the end of which, MyNewStr will only contain the digits 0 - 9
for i = 1 to len(MyStr)
select case mid$(MyStr,i,1)
case 0 to 9
MyNewStr=MyNewStr & mid$(MyStr,i,1)
Last edited by gupex; 04-07-2005 at 09:09 AM.
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center