Can anyone help me with this: I have a string, containing an amount of
numbers to begin with, then eventually some text, like
strLine = "0476334089 (home number)"
I want to format the numbers en let the text be unchanged, so the result is
like this
0476/33 40 89 (home number)
The numbers must be formatted using a pattern and the text must be left
unchanged.
All suggestions are welcome.
Many thanks and greetings,
Michel 3 983
On Jun 1, 11:26 am, "Michel Vanderbeke" <michel.vanderb...@skynet.be>
wrote:
Can anyone help me with this: I have a string, containing an amount of
numbers to begin with, then eventually some text, like
strLine = "0476334089 (home number)"
I want to format the numbers en let the text be unchanged, so the result is
like this
0476/33 40 89 (home number)
The numbers must be formatted using a pattern and the text must be left
unchanged.
All suggestions are welcome.
Many thanks and greetings,
Michel
Have you looked into the String.Format method?
I did, but I cannot get the result I want.
In the example I gave you, the result must be: three numbers - a slash - two
numbers - a space - two numbers - a space - two numbers - the unchanged
text.
I do not see how I can achieve that with String.Format.
Michel
<za***@construction-imaging.comschreef in bericht
news:11*********************@o5g2000hsb.googlegrou ps.com...
On Jun 1, 11:26 am, "Michel Vanderbeke" <michel.vanderb...@skynet.be>
wrote:
>Can anyone help me with this: I have a string, containing an amount of numbers to begin with, then eventually some text, like strLine = "0476334089 (home number)"
I want to format the numbers en let the text be unchanged, so the result is like this 0476/33 40 89 (home number)
The numbers must be formatted using a pattern and the text must be left unchanged.
All suggestions are welcome. Many thanks and greetings,
Michel
Have you looked into the String.Format method?
You might use Regular expressions. Something like this
Dim oMatchs As MatchCollection
Dim oReg As New Regex("^(\d{4})(\d{2})(\d{2})(\d{2})\s*(\S*)")
oMatchs = oReg.Matches(TextBox1.Text)
Label1.Text = oReg.Replace(TextBox1.Text, "$1/$2 $3 $4 $5")
This is probabily not anywhere near the best regex pattern but maybe it
could get you started.
Lauren
"Michel Vanderbeke" <mi***************@skynet.bewrote in message
news:e3*************@TK2MSFTNGP06.phx.gbl...
Can anyone help me with this: I have a string, containing an amount of
numbers to begin with, then eventually some text, like
strLine = "0476334089 (home number)"
I want to format the numbers en let the text be unchanged, so the result
is like this
0476/33 40 89 (home number)
The numbers must be formatted using a pattern and the text must be left
unchanged.
All suggestions are welcome.
Many thanks and greetings,
Michel This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Steve Holden |
last post by:
I was messing about with formatting and realized that the right kind of
object could quite easily tell me exactly what accesses are made to the
mapping in a string % mapping operation. This is a...
|
by: Jouke Langhout |
last post by:
Hello all!
For quite some time now, I've got the following problem:
Access won't close properly when a user closes the application. An
ACCESS process stays active and that process can only be...
|
by: BBFrost |
last post by:
I'm receiving decimal values from database queries and placing them on a
report page.
The users want to see the following ....
Db Value Display Value
123.3400 123.34...
|
by: Robert Manookian |
last post by:
How do you format strings? i.e.
In VB6: Format("AB34567", "@@@@@-@@") = "AB345-67"
In .Net: ????????
|
by: David Veeneman |
last post by:
How does one format a date column in a GridView control? I had assumed that
the DataFormat string would do it, but MSDN only shows numeric formatting
codes. Can dates be formatted using that...
|
by: Peter Newman |
last post by:
the data input app im writing has some 30 + input fields and i want to be
able to format them.
I know i can use the .validate on each textbox and format the 'string'
however this require loads...
|
by: Dustan |
last post by:
Is there any builtin function or module with a function similar to my
made-up, not-written deformat function as follows? I can't imagine it
would be too easy to write, but possible...
'I am...
|
by: john coltrane |
last post by:
Is there way to create a formatted string in a similar that is similar to
sprintf?
The same for printing, printf?
C,D,E,F,G,N,X for currency, decimal, exponential, fixed, general, numerical,...
|
by: Tomasz J |
last post by:
Hello developers,
I bind my TextBox control specyfying a format stored in my application
global ApplicationContext object - it has a static string CurrencyFormat
property.
The problem - this...
|
by: Jean-Paul Calderone |
last post by:
On Fri, 5 Sep 2008 14:24:16 -0500, Robert Dailey <rcdailey@gmail.comwrote:
mystring = (
"This is a very long string that "
"spans multiple lines and does "
"not include line breaks or tabs "...
|
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...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
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: 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: 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...
|
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...
| |