473,379 Members | 1,326 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,379 software developers and data experts.

Removing wild characters from a string

hi

I am tring to remove all the wild characters from a string. Is there
any short method to remove them in a single go.

I am right now tring to replace one by one.

Ex (999) 999-9999

I need 9999999999 with out all the charecters and spaces. I am trying
eliminate one by one now.

If you have any other ideas please post it

Thank You,
Satish

Nov 29 '05 #1
4 2436
I don't know if this is the best solution, but you can loop through
character by character, examine each one, and if it is a digit, add it to a
brand new string. After you are done, the new string will have only the
digits.

"SatishPasala" <ps***********@gmail.com> wrote in message
news:11**********************@g44g2000cwa.googlegr oups.com...
hi

I am tring to remove all the wild characters from a string. Is there
any short method to remove them in a single go.

I am right now tring to replace one by one.

Ex (999) 999-9999

I need 9999999999 with out all the charecters and spaces. I am trying
eliminate one by one now.

If you have any other ideas please post it

Thank You,
Satish

Nov 29 '05 #2
Learn Regular Expressions. They can be used for updating strings as well as
searching...

You can accomplish in just a couple of lines of code (with Regular
Expressions) what would otherwise require many many lines of code in a
looping approach that builds a new string from the old OR uses
StringBuilder...

-HTH
"SatishPasala" <ps***********@gmail.com> wrote in message
news:11**********************@g44g2000cwa.googlegr oups.com...
hi

I am tring to remove all the wild characters from a string. Is there
any short method to remove them in a single go.

I am right now tring to replace one by one.

Ex (999) 999-9999

I need 9999999999 with out all the charecters and spaces. I am trying
eliminate one by one now.

If you have any other ideas please post it

Thank You,
Satish

Nov 29 '05 #3
From the server-side add on top of the codebehind:
using System.Text.RegularExpressions;

Then in the body of the function

//a pattern to find non word characters
Regex re = new Regex ("[^\\w]+");
//replace the matched pattern
Response.Write (re.Replace("(99)@3-87-9%!~(9175)", ""));
//should print 9938799175
If you are doing it using Javascript on the client-side:
alert("(99)@3-87-9%!~(9175)".replace(/[^\w]+/g,""));
--
HTH,
Phillip Williams
http://www.societopia.net
http://www.webswapp.com
"SatishPasala" wrote:
hi

I am tring to remove all the wild characters from a string. Is there
any short method to remove them in a single go.

I am right now tring to replace one by one.

Ex (999) 999-9999

I need 9999999999 with out all the charecters and spaces. I am trying
eliminate one by one now.

If you have any other ideas please post it

Thank You,
Satish

Nov 29 '05 #4
The regular expression worked really good. thank Phillip

Thank you guys for the help.
satish

Nov 29 '05 #5

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

Similar topics

2
by: Paweł | last post by:
Hello! I'm looking for efficient code or site where I can find code for finding one string in another string. String which I search should have "wild" characters like '?' for any one char and...
2
by: Keith | last post by:
A2003, XP Pro. I'm writing a VBA procedure to remove wildcard characters from a number of fields in various tables. I'm calling a sub routine and passing in strings representing the character...
6
by: Niyazi | last post by:
Hi all, What is fastest way removing duplicated value from string array using vb.net? Here is what currently I am doing but the the array contains over 16000 items. And it just do it in 10 or...
1
by: Nitinkcv | last post by:
Hi, I have a textbox and a button. In my textbox i have to enter the query string(say shoes) and on clicking the button takes me to a page show all item related to the search string( in this case...
3
by: MLH | last post by:
Back in mid-2003, lucason posted a question about removing punctuation chars from a string. Suggested code was posted using Replace function. Could the FN below be easily modified for use with A97...
9
by: Sreeraj | last post by:
hi, I am a beginner in Python. I wish to know how can i filter a list of strings using wild characters.ie Lets say i have list countries = . I need only the list of string starting with 'a'. ...
11
by: ramu | last post by:
Hi, Suppose I have a string like this: "I have a string \"and a inner string\\\" I want to remove space in this string but not in the inner string" In the above string I have to remove...
7
by: W. eWatson | last post by:
Is it possible to do a search for a wild card string in another string. For example, I'd like to find "v*.dat" in a string called bingo. v must be matched against only the first character in bingo,...
13
by: Eps | last post by:
Hi there, I believe all strings in .net are unicode by default, I am looking for a way to remove all non ascii characters from a string (or optionally replace them). There is an article on...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
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$) { } ...
0
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...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...

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.