Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Determine if the second character in a string is a number

Posted on 2006-07-23
3
Medium Priority
?
177 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 93

Accepted Solution

by:
Patrick Matthews earned 1000 total points
ID: 17165049
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
ID: 17165137
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
ID: 17165159
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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

610 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