Solved

Determine if the second character in a string is a number

Posted on 2006-07-23
3
165 Views
Last Modified: 2010-04-30
I am using VB6 and I need a way to determine if the second character in a string is a variable.  I found the following code:

result = (isnumber(Value(Left(myString, 2))))

There were no functions listed with this code so I thought it was using functions build into VB6, but it must not be the case because it does not work.

Does anyone know an easy way to determine if the second character in a string is a number?
0
Comment
Question by:bpl5000
  • 2
3 Comments
 
LVL 92

Accepted Solution

by:
Patrick Matthews earned 250 total points
Comment Utility
Hi bpl5000,

If IsNumeric(Mid(myString, 2, 1)) Then
    'action for is a numeral
Else
    'action for not a numeral
End If

Regards,

Patrick
0
 
LVL 5

Author Comment

by:bpl5000
Comment Utility
Thanks Patrick!  This works great, but I thought Left would be the way to go.  Looks like I'm wrong (again... D'oh!).  I guess if I say "If IsNumeric(Left(myString, 2)) Then"... this is looking at the first 2 characters instead of only the second character?
0
 
LVL 5

Author Comment

by:bpl5000
Comment Utility
No need to answer that question my last question... I tried:

MsgBox Left(myString, 2)

and now I see it does give you the first two digits.
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now