473,396 Members | 2,018 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Problem in Strings in ASP.NET(vb)

144 100+
Hai friends...
In our Organization... we have regno...like 06AKK012 06AK012 06A012

Now my question...whenever user enter regno.. I want to Extract..till last alphabetic charcter of regno...
for example..

06AKK012 => 06AKK
06AK012 => 06AK
06A012 => 06A


is there any option.....
give me coding what we write.... in webform.aspx.vb....
Thank u...
Davidson..
Mar 26 '08 #1
7 1173
Plater
7,872 Expert 4TB
Well if you treated the string as a char[] (which it is in a way) and start sliding to the left, using .IsLetter().
As soon as it says yes, set a boolean value. When it finds a "non letter" after the boolean has been set (so you know it has made it through the alphabetic characters). you can exit out of the loop and return the index that you were on in the char[].
Mar 26 '08 #2
davidson1
144 100+
Thank u plater..

can u give me coding...in asp.net(vb language)

what we write in webform.aspx.vb

Davidson.......
Mar 26 '08 #3
r035198x
13,262 8TB
Thank u plater..

can u give me coding...in asp.net(vb language)

what we write in webform.aspx.vb

Davidson.......
You could go clever and use the Split function with a regex.
Mar 26 '08 #4
davidson1
144 100+
Thank u r035...

if u give sample coding....it will be understandable....

please...
Mar 26 '08 #5
kunal pawar
297 100+
U can convert string to character array and then check character is letter.
like this
Dim c() As Char
Dim i,flg,pos as Int16
flg=1
c = str.ToCharArray
for i=0 to c.length
if flg=2 and c(i).Isnumaric() then
pos = i
exit for
end if
if c(i).IsLetter() then
flg=2
end if

next
substring the string upto pos
Mar 26 '08 #6
Plater
7,872 Expert 4TB
if you have a string, you can refer to it just like an array, no need to call .ToCharArray() for it.
Mar 26 '08 #7
r035198x
13,262 8TB
How about
Expand|Select|Wrap|Line Numbers
  1. Imports System.Text.RegularExpressions
  2. Module Module1
  3.     Sub Main()
  4.         Dim regNo As String
  5.         regNo = "06AK012"
  6.         Dim r As Regex
  7.         r = New Regex("\D")
  8.         Dim s As String() = Nothing
  9.         s = r.Split(regNo)
  10.         Dim t As String
  11.         t = regNo.Substring(regNo.IndexOf(s(s.Length - 1)))
  12.         Dim v As String
  13.         v = regNo.Substring(0, regNo.IndexOf(t))
  14.         MsgBox(v)
  15.     End Sub
  16. End Module
Washes mouth for writing VB
Mar 26 '08 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Greg | last post by:
Hi. I am writing an INTRAnet app using asp.net/VB that, amongst other things, needs to access the global address list in Outlook, extract some email addresses and send email to these people. ...
2
by: John Howard | last post by:
Where can I find a good explination and example of using VB.Net/ASP.net to browse an MS Access database using ADO.Net? Thanks in advance, John
9
by: ASP .NET Newbie | last post by:
How can I run a WebBrowser control using ASP.NET/VB.NET? I know I can use the WebClient to get the page data, but I need to be able to use the WebBrowser (AxWebBrowser)? Thanks, Chad
6
by: Jerome Cohen | last post by:
I need to implement a simple application that listens for web requests on a well-known URL, grab the request , which is an XML document, and send as respnse an XML document. each client sends a...
9
by: James | last post by:
So far, is basically dispise ADO.NET & VB.NET. Here's why: Too many confusing ways to do simple things. Here are two examples that maybe someone can help me with: (1) I have TextBox controls...
4
by: S. Ahmed | last post by:
Hi all: I am new to VB, especially to VB .NET. I need to create an ActiveX DLL that I can then use in another application (LabView). I know in VB 6.0, creating ActiveX DLL was easy. The...
4
by: Henry | last post by:
Is there a way in ASP.NET/VB.NET to get the current form name. I'd like to store the name in a session variable for use on an Error page and use it to return to the page that had the error. Tks...
4
by: ARJOBS.CO.IN | last post by:
Hi MNC based at noida is conducting a grand for the following technology domains : o ASP.Net, VB.Net or C# and Oracle o Experience : 3 + years Date: June 9, 2007 Time: ...
1
by: venkat6725 | last post by:
hi, how to use the asp.net ajax in all the web forms migrated from (asp.net,vb.net,2003) to (asp.net,vb.net,2005) needs clear description thanks
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.