Hello,
Is there a way to remove all non-digit characters from a string in one call?
string.Replace() methods don't allow this.
thanks! 7 11078
Use regex
--
Regards,
Tamir Khason
Especially those days you need a flexible IT service provider that can meet
your needs through a broad set of offerings.
TCON - A technology company that understands your business. www.tcon.co.il
"Zeng" <zz*@nonospam.com> wrote in message
news:Oa**************@TK2MSFTNGP10.phx.gbl... Hello,
Is there a way to remove all non-digit characters from a string in one
call? string.Replace() methods don't allow this.
thanks!
string s = Regex.Replace(oBox.Text,"\\D","")
or "\\d" one means digit the other one means non digit. i forget at the
moment which is which.
--
-----------
Got TidBits?
Get it here: www.networkip.net/tidbits
"Tamir Khason" <ta**********@tcon-NOSPAM.co.il> wrote in message
news:#T**************@TK2MSFTNGP09.phx.gbl... Use regex
-- Regards, Tamir Khason Especially those days you need a flexible IT service provider that can
meet your needs through a broad set of offerings. TCON - A technology company that understands your business. www.tcon.co.il
"Zeng" <zz*@nonospam.com> wrote in message news:Oa**************@TK2MSFTNGP10.phx.gbl... Hello,
Is there a way to remove all non-digit characters from a string in one call? string.Replace() methods don't allow this.
thanks!
Regex.Replace(sInput,"\d","")
"Zeng" <zz*@nonospam.com> wrote in message
news:Oa**************@TK2MSFTNGP10.phx.gbl... Hello,
Is there a way to remove all non-digit characters from a string in one
call? string.Replace() methods don't allow this.
thanks!
Acutally, it should be Regex.Replace(myInput, @"\d", string.Empty);
"William Ryan" <do********@comcast.nospam.net> wrote in message
news:ee*************@TK2MSFTNGP12.phx.gbl... Regex.Replace(sInput,"\d","") "Zeng" <zz*@nonospam.com> wrote in message news:Oa**************@TK2MSFTNGP10.phx.gbl... Hello,
Is there a way to remove all non-digit characters from a string in one call? string.Replace() methods don't allow this.
thanks!
good idea on the string.empty the @ is optional
--
-----------
Got TidBits?
Get it here: www.networkip.net/tidbits
"William Ryan" <do********@comcast.nospam.net> wrote in message
news:ue**************@TK2MSFTNGP12.phx.gbl... Acutally, it should be Regex.Replace(myInput, @"\d", string.Empty); "William Ryan" <do********@comcast.nospam.net> wrote in message news:ee*************@TK2MSFTNGP12.phx.gbl... Regex.Replace(sInput,"\d","") "Zeng" <zz*@nonospam.com> wrote in message news:Oa**************@TK2MSFTNGP10.phx.gbl... Hello,
Is there a way to remove all non-digit characters from a string in one call? string.Replace() methods don't allow this.
thanks!
Yeah, I flip back and forth between C# and VB.NET a lot, so I always code
like the other one for the first few hours. Someday I'll remember it @.
"Alvin Bruney" <vapordan_spam_me_not@hotmail_no_spamhotmail.com > wrote in
message news:ul**************@TK2MSFTNGP11.phx.gbl... good idea on the string.empty the @ is optional
--
----------- Got TidBits? Get it here: www.networkip.net/tidbits "William Ryan" <do********@comcast.nospam.net> wrote in message news:ue**************@TK2MSFTNGP12.phx.gbl... Acutally, it should be Regex.Replace(myInput, @"\d", string.Empty); "William Ryan" <do********@comcast.nospam.net> wrote in message news:ee*************@TK2MSFTNGP12.phx.gbl... Regex.Replace(sInput,"\d","") "Zeng" <zz*@nonospam.com> wrote in message news:Oa**************@TK2MSFTNGP10.phx.gbl... > Hello, > > Is there a way to remove all non-digit characters from a string in
one call? > string.Replace() methods don't allow this. > > thanks! > >
Thanks, it should be "\D" .
"William Ryan" <do********@comcast.nospam.net> wrote in message
news:ue**************@TK2MSFTNGP12.phx.gbl... Acutally, it should be Regex.Replace(myInput, @"\d", string.Empty); "William Ryan" <do********@comcast.nospam.net> wrote in message news:ee*************@TK2MSFTNGP12.phx.gbl... Regex.Replace(sInput,"\d","") "Zeng" <zz*@nonospam.com> wrote in message news:Oa**************@TK2MSFTNGP10.phx.gbl... Hello,
Is there a way to remove all non-digit characters from a string in one call? string.Replace() methods don't allow this.
thanks!
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: chris |
last post by:
is there a quick and easy way to check a string for non numeric characters ?
i have thought of making a routine to check each character to confirm it is
0 - 9 but was wondering if there was a...
|
by: Adrian Herscu |
last post by:
Hi all,
In which circumstances it is appropriate to declare methods as non-virtual?
Thanx,
Adrian.
|
by: ElGordo |
last post by:
I was recently given .Net project files to work on. When I open the
Solution file in VS.Net, I always get the message:
"The solution appears to be under source control, but its binding...
|
by: SStory |
last post by:
How can I strong name my assembly if it references 3rd part non-strong named
dlls?
I just want my part strong named--I don't care about their part.
Thanks,
Shane
|
by: utab |
last post by:
Dear all,
Is there a clear distinction how to decide which functions to be
members of a class and which not
How is your attitude (Your general way from your experiences ...)
"If the...
|
by: Andrew R |
last post by:
Hi
I'm creating a series of forms, each with with around 15-20 text boxes.
The text boxes will show data from tables, but are unbound to make them
more flexible.
I want the form to be used...
|
by: Jarry |
last post by:
I was editing a huge XML file that a friend of mine had made and I
didn't need some of the tags. WHen I was finished editing it, I
realised I had a lot of information between tags, in no man's...
|
by: Benjamin Goudey |
last post by:
I have a very large list of integers representing data needed for a
histogram that I'm going to plot using pylab. However, most of these
values (85%-95%) are zero and I would like to remove them to...
|
by: puzzlecracker |
last post by:
if I provide a key of element that doesn't exist in the set, and I
call set.erase(nonInSetKey), does standard guarantee that nothing
"BAD" will happen, in fact, nothing at all will happen.
Does...
|
by: kshw |
last post by:
Hi,
I'm trying to remove non-stop words from a text file using regular expresions but it is not working. I used something like ('^?or') in order to avoid removing (or) from the mibble of words...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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,...
|
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...
|
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,...
|
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...
| |