473,403 Members | 2,366 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,403 software developers and data experts.

string manupilation

Hi there a receive a string from a recordset which contains a telephone
number.

It looks like: (03) 9888 5566

How can I manipulate the string, so that the () are deleted.

It should look like this: 03 9888 5566

I also receive a string which contains a mobile number. There should be
another empty space.

It looks like: 0407 566454

But it should look like 0407 566 454

I can't work it out. It drives me nuts :-(

Thanks for your help

Chris
Nov 17 '05 #1
2 1297
Your first question:

newNumber = oldNumber.Replace("(","").Replace(")","");

And for your second, if you're positive that the incoming string is always
formatted like you have it, then just use

newNumber = oldNumber.Substring(0,8) + " " + oldNumber.Substring(8);

Dale Preston
MCAD, MCDBA, MCSE

"chris" <ch***@discussions.microsoft.com> wrote in message
news:58**********************************@microsof t.com...
Hi there a receive a string from a recordset which contains a telephone
number.

It looks like: (03) 9888 5566

How can I manipulate the string, so that the () are deleted.

It should look like this: 03 9888 5566

I also receive a string which contains a mobile number. There should be
another empty space.

It looks like: 0407 566454

But it should look like 0407 566 454

I can't work it out. It drives me nuts :-(

Thanks for your help

Chris

Nov 17 '05 #2
Thank you Dale. This is amazing.

Cheers

Chris

"Dale Preston" wrote:
Your first question:

newNumber = oldNumber.Replace("(","").Replace(")","");

And for your second, if you're positive that the incoming string is always
formatted like you have it, then just use

newNumber = oldNumber.Substring(0,8) + " " + oldNumber.Substring(8);

Dale Preston
MCAD, MCDBA, MCSE

"chris" <ch***@discussions.microsoft.com> wrote in message
news:58**********************************@microsof t.com...
Hi there a receive a string from a recordset which contains a telephone
number.

It looks like: (03) 9888 5566

How can I manipulate the string, so that the () are deleted.

It should look like this: 03 9888 5566

I also receive a string which contains a mobile number. There should be
another empty space.

It looks like: 0407 566454

But it should look like 0407 566 454

I can't work it out. It drives me nuts :-(

Thanks for your help

Chris


Nov 17 '05 #3

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

Similar topics

16
by: Krakatioison | last post by:
My sites navigation is like this: http://www.newsbackup.com/index.php?n=000000000040900000 , depending on the variable "n" (which is always a number), it will take me anywhere on the site......
5
by: Stu Cazzo | last post by:
I have the following: String myStringArray; String myString = "98 99 100"; I want to split up myString and put it into myStringArray. If I use this: myStringArray = myString.split(" "); it...
9
by: John F Dutcher | last post by:
I use code like the following to retrieve fields from a form: recd = recd.append(string.ljust(form.getfirst("lname",' '),15)) recd.append(string.ljust(form.getfirst("fname",' '),15)) etc.,...
1
by: Wolf | last post by:
Hi Hope someone can help me, I am trying to pass in a string in part nr 2. The string is defined in nr 1.Somehow it breaks because of the ' The string I'm passing in should be something like:...
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: 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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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...
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
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,...
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
isladogs
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...

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.