Click here to Skip to main content
15,936,014 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:

In a form I have a textbox.

I am passing text values A1 A2 A3 A4 A5 like this, but I want to separate the integer values and string values like 'A''1'.

How shall I do this?
Updated 1-Dec-10 21:49pm
Sandeep Mewara 2-Dec-10 2:34am    
What are the possible text values? If it's just A1, A2 types then you can use substring and get it.
Rajesh Anuhya 2-Dec-10 3:12am    
No Effort..
sameertm 2-Dec-10 3:18am    
thnks alot
Dalek Dave 2-Dec-10 3:49am    
Edited for Grammar and Readability.

1 solution

As already suggested, if the format is fixed, then you may use Substring method, for instance:

Dim s As String = "A5"
Dim letter As String = s.Substring(0, 1)
Dim digit As String = s.Substring(1, 1)

On the other hand, for a more complex format, you probably have to somehow parse the string (in such a case have a look at Regex class[^]).
Share this answer
Dalek Dave 2-Dec-10 3:49am    
Good Call.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900