473,890 Members | 1,769 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

removing alpha characters from string

Is there any quick and easy (other then scanning a string char by char) to
remove all the alpha chars from a string and leave only numbers?



comes out to 123342343431
Nov 21 '05 #1
2 16905
"Brian Henry" <no****@nospam. com> schrieb:
Is there any quick and easy (other then scanning a string char by char) to
remove all the alpha chars from a string and leave only numbers?



comes out to 123342343431

Imports System.Text.Reg ularExpressions
Dim s As String = "A23zb4-u98"
MsgBox(Regex.Re place(s, "[^0-9]", ""))

M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 21 '05 #2
just use a regex that extracts only the numbers?

--- Nick Malik [Microsoft]
MCSD, CFPS, Certified Scrummaster

Disclaimer: Opinions expressed in this forum are my own, and not
representative of my employer.
I do not answer questions on behalf of my employer. I'm just a
programmer helping programmers.
"Brian Henry" <no****@nospam. com> wrote in message
news:%2******** **********@TK2M SFTNGP09.phx.gb l...
Is there any quick and easy (other then scanning a string char by char) to
remove all the alpha chars from a string and leave only numbers?



comes out to 123342343431

Nov 21 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

by: Amit Varia | last post by:
How would you remove newline characters from a string? I tried str_replace("\n", "", $string); But that doesn't work.
by: Mark C | last post by:
All, Is there such a function that can strip all non alpha ( not between a-z) characters from a string? I have a function that I currently use that will strip one character at a time from a string that I tried tweaking without success. Any help would be much appreciated. Thanks in advance, Mark C. hereinde@yahoo.com
by: PCV | last post by:
Hi All, I want to create a custom auto number in a form that looks like "CRA05001" where "CR" are fixed characters, then "A" should be for January as "B" for February and so on...(this part will change depending on the month, "05001" is the year "05" and "001" a sequential increment. I Know how to get "CR?05001" but I'm stuck on trying to convert the month number to the alpha characters. Any suggestions? Thanks in advance. This is a...
by: becte | last post by:
I am little bit confused Is this a legal way of removing a substring from a string? What about the second alternative using strcpy, is it ok even though the source and dest. strings overlap? // Remove (first occurence of) sub from src void func(char *src, char *sub) { char *p;
by: Tim Conner | last post by:
I wrote the following function to test a string for characters from a to z and the "_" character : public static bool IsAlpha( char Value ) { Regex regExp = new Regex("^*$"); if (regExp.IsMatch( Value.ToString() )) { return true; }
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 chars. i'm assuming python has something like valid_str = strip(invalid_str)
by: Benny the Guard | last post by:
I have a string value that may contain some unprintable characters. I am using the xml.sax.escape to remove the the <, > and & characters fine but it seems to leave in the \n characters. Later this string gets added to some XML, which is UTF-8 encoded, which fails since charcater code 8 is invalid UTF-8. I figured it was a problem with ASCII -> UTF-8 (by the way how do you do newlines in UTF-8 encoded XML?). So I tried the following...
by: Betray | last post by:
i have a table that lets say has 3 fields ID, NAME, SEARCHFIELD name can take any character, while searchfield only has the alpha/num characters from name. (eg name: Swine-?6$Man Searchfield:Swine6Man) is there a way i could do this by just passing in the name to a stored procedure? the reason im doing this, is if a user wants to search a database with only know the word/numerical values he knows. i couldnt think of another way, and im...
by: Andrew Sweney | last post by:
I have a system that generates a 24ch alpha-numeric string as a tracking number. An example looks like this - 1898240001631501AKL003HS. This is great for what it does (there is information embedded in that string that tells me stuff that I need to know). However, when a customer tries to use an IVR or web site to self service (a tracking enquiry) the number is way too long and prone to error when being entered via DTMF, Speech recognition...
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.