473,545 Members | 2,094 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problem in Strings in ASP.NET(vb)

144 New Member
Hai friends...
In our Organization... we have regno...like 06AKK012 06AK012 06A012

Now my question...when ever 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 1181
Plater
7,872 Recognized Expert Expert
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 New Member
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 MVP
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 New Member
Thank u r035...

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

please...
Mar 26 '08 #5
kunal pawar
297 Contributor
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 Recognized Expert Expert
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 MVP
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
4987
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. (actually, I believe I will have to be using Outlook's Web client). I am spending vast amounts of time trawling unsuccessfully thru MSDN and Help...
2
1724
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
3795
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
5566
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 first request and I return failure or a session ID which I store, and further requests should have the session ID. isn't there a sim[ple way to do...
9
1488
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 on a form bound to Date fields in a DataSet. Works great, except that when the TextBox fields lose focus, when their Text paramter is a Date, the...
4
11517
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 documentations says, 'class library' now replaces ActiveX DLL. Also, someone told me that an ActiveX DLL can be exported from .NET VB. I would really...
4
5123
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 for any input. *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it!
4
1878
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: 10 AM to 2 PM To know details pls visit http://www.arjobs.co.in/job_details.php?jobid=913 Thanks
1
1037
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
7401
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7656
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7807
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
7756
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
3450
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3442
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1879
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1014
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
703
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.