473,473 Members | 1,800 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Removing letters from strings

153 New Member
Since people have been so helpful on this site I thought I'd contribute what little I can...since I am not a programmer but I'm working on an access database for work

Anyways I had to remove letters from serial numbers so I could strip them down to their bare numbers. These serial numbers had the form of WAL28839940LT. The following code will help to strip off the letters at the end.

Option Compare Database

Public Function GetEndIndex(ByVal str As String) As Integer
Dim i As Integer
Dim retVal As Integer
Dim testChar As String
Dim ascValue As Integer

retVal = 0
For i = 3 To Len(str) - 1
testChar = Mid(str, i + 1, 1)
ascValue = Asc(testChar)
If ascValue < 48 Or ascValue > 57 Then
retVal = i
Exit For
End If
Next
GetEndIndex = retVal



End Function

The 'GetEndIndex' gives the amount of numbers which are in the serial number. In this case I knew, however, that there would always be three letters preceding the numbers but I did not know how many letters would be the end. So from this I output the numbers into an integer using an SQL query which outputs numbers from the fourth character until the 12th character, for example, if it is determined that there are 9 numbers. So this is very specific to find the length of numbers and to remove the end letters but it could be modified to do other things that may help...but since the programs we use are relatively common in other companies to keep track of our systems, it may be helpful to others who are looking to do the same thing.
Nov 3 '06 #1
1 5428
PEB
1,418 Recognized Expert Top Contributor
Well done...

Very good idea to share functions like this...

Congrats my friend...

:)
Nov 4 '06 #2

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

Similar topics

2
by: Edward K. Ream | last post by:
From the documentation for the string module at: C:\Python23\Doc\Python-Docs-2.3.1\lib\module-string.html letters: The concatenation of the strings lowercase and uppercase described below....
19
by: Johannes Nix | last post by:
Hello, yesterday I met a cute person (after my dance class) who told me about an interesting experiment regarding cognition. People were told to read a typed text; However, in every word in the...
3
by: Aristotle | last post by:
Could you please help me out with regular expressions. I'm trying to write a perl script that proccesses some text, and i'm stuck at the following: need to remove from the text 1. dots followed...
1
by: ChrisC | last post by:
Im having trouble removing line breaks from my c# string. Actually, im having trouble getting .Trim() to work properly, as it seems to count a string that has nowt but a break of some sort as not...
2
by: Joachim | last post by:
I'm using the following to transfer the content of two strings containing non-english letters byte responseB = Encoding.ASCII.GetBytes(responseHdr.ToString() + responseBody.ToString()); But...
6
by: bruce | last post by:
hi... i'm running into a problem where i'm seeing non-ascii chars in the parsing i'm doing. in looking through various docs, i can't find functions to remove/restrict strings to valid ascii...
4
by: jerger | last post by:
i have a great program now with the help of a member from this site, but i need a little customization to meet the needs of non-english speakers... who might accidendtly type punctuation which would...
15
by: Academia | last post by:
I want a string of characters that will sort after all strings of Roman letters. Something that will display using a font like the one this note is written with. Is there such a thing? I...
2
by: wwtan | last post by:
I want to remove the numbers and letters on the left on a string. I have some strings which read as such: ATT 2393747394 AT&T 2732372Tom CAN Air38263 AA3333333
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
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...
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
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
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
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...
0
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 ...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
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...

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.