469,917 Members | 1,578 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,917 developers. It's quick & easy.

Formatting String

How do you format strings? i.e.
In VB6: Format("AB34567", "@@@@@-@@") = "AB345-67"
In .Net: ????????
Nov 20 '05 #1
4 3844
Try this:

String.Format("{0:###0.00}", myValue)

Robert Manookian wrote:
How do you format strings? i.e.
In VB6: Format("AB34567", "@@@@@-@@") = "AB345-67"
In .Net: ????????


Nov 20 '05 #2
This only works for numeric data. I what to format string text.

"User" <gu***@guest.com> wrote in message
news:fMfHc.9545$Rf.5175@edtnps84...
Try this:

String.Format("{0:###0.00}", myValue)

Robert Manookian wrote:
How do you format strings? i.e.
In VB6: Format("AB34567", "@@@@@-@@") = "AB345-67"
In .Net: ????????

Nov 20 '05 #3
* "Robert Manookian" <my****@home.com> scripsit:
How do you format strings? i.e.
In VB6: Format("AB34567", "@@@@@-@@") = "AB345-67"
In .Net: ????????


I don't have an idea too, but it seems that the behavior of 'Format' has
changed. Formatting for strings seems to be gone according to the
documentation. Really annoying.

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #4
From the MSDN online:

"Examples of characters that can't be displayed as literal characters are the date-formatting and time-formatting characters (a, c,
d, h, m, n, p, q, s, t, w, y, /, and :), the numeric-formatting characters (#, 0, %, E, e, comma, and period), and the
string-formatting characters (@, &, <, >, and !)."

Seems they changed the behavior and failed to completely clean-up the documentation.

--
Al Reid
"It ain't what you don't know that gets you into trouble. It's what you know
for sure that just ain't so." --- Mark Twain

"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message news:2l************@uni-berlin.de...
* "Robert Manookian" <my****@home.com> scripsit:
How do you format strings? i.e.
In VB6: Format("AB34567", "@@@@@-@@") = "AB345-67"
In .Net: ????????


I don't have an idea too, but it seems that the behavior of 'Format' has
changed. Formatting for strings seems to be gone according to the
documentation. Really annoying.

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>

Nov 20 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by Thomas Philips | last post: by
11 posts views Thread by Steve Holden | last post: by
7 posts views Thread by ilona | last post: by
2 posts views Thread by Ken Wilson | last post: by
4 posts views Thread by hope | last post: by
7 posts views Thread by L. Scott M. | last post: by
8 posts views Thread by gopal | last post: by
14 posts views Thread by Scott M. | last post: by
6 posts views Thread by Jack | last post: by
6 posts views Thread by Tomasz J | last post: by
1 post views Thread by Waqarahmed | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.