By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,695 Members | 1,207 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,695 IT Pros & Developers. It's quick & easy.

Formatting String

P: n/a
How do you format strings? i.e.
In VB6: Format("AB34567", "@@@@@-@@") = "AB345-67"
In .Net: ????????
Nov 20 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
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

P: n/a
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

P: n/a
* "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

P: n/a
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.