Private mFormat As String = "##.##"
Return DirectCast(value, Double).ToString(mFormat) returns "" when
value is 0.0
I would prefer that it return "0". Does anyone have some advice?
Thanks for any help
Jeremy Kitchen 5 947
Try this fromat string to see if it gives you what you want (I think
it should always show a leading zero before the decimal point).
"#0.##"
================
Clay Burch
Syncfusion, Inc.
Jeremy Kitchen wrote:
Private mFormat As String = "##.##"
Return DirectCast(value, Double).ToString(mFormat) returns "" when
value is 0.0
I would prefer that it return "0". Does anyone have some advice?
The # indicates an optional number, but you can use 0 for "always a number,
and 0 if there's nothing in there".
Private mFormat As String = "#0.##"
Andrew
Hello, Jeremy,
You could try:
Private mFormat As String = "#0.##"
Cheers,
Randy
Jeremy Kitchen wrote:
Private mFormat As String = "##.##"
Return DirectCast(value, Double).ToString(mFormat) returns "" when
value is 0.0
I would prefer that it return "0". Does anyone have some advice?
Thanks for any help
Jeremy Kitchen
Hello R. MacDonald,
Hmm... You could enclose the statement in Val
Val(DirectCast(value, Double).ToString(mFormat) )
-- You can do anything with a little bit of 'magination.
-- I've been programming so long, my brain is now software.
Hello, Jeremy,
You could try:
Private mFormat As String = "#0.##"
Cheers,
Randy
Jeremy Kitchen wrote:
>Private mFormat As String = "##.##"
Return DirectCast(value, Double).ToString(mFormat) returns "" when value is 0.0
I would prefer that it return "0". Does anyone have some advice?
Thanks for any help
Jeremy Kitchen
That doesn't produce a formatted string.
Cyril Gupta <cyrilgupta wrote:
Hello R. MacDonald,
Hmm... You could enclose the statement in Val
Val(DirectCast(value, Double).ToString(mFormat) )
-- You can do anything with a little bit of 'magination.
-- I've been programming so long, my brain is now software.
>Hello, Jeremy,
You could try:
Private mFormat As String = "#0.##"
Cheers, Randy Jeremy Kitchen wrote:
>>Private mFormat As String = "##.##"
Return DirectCast(value, Double).ToString(mFormat) returns "" when value is 0.0
I would prefer that it return "0". Does anyone have some advice?
Thanks for any help
Jeremy Kitchen
--
Göran Andersson
_____ http://www.guffa.com This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Jessica |
last post by:
Hi,
I have a question regarding the object-oriented issue. I understand
that a class is a type. I have an array class. Now say that I want
to implement an algorithm A that uses the array class....
|
by: Daniel Lidström |
last post by:
Hi,
I'm currently using this method to extract doubles from a string:
System::String* sp = S" ";
System::String* tokens = s->Trim()->Split(sp->ToCharArray());
m_Northing =...
|
by: Matt Garman |
last post by:
I've got some code that generates a report for the user. The report is
shown with explanatory verbage. The text is relatively long, and also
has some simple formatting (paragraphs, bulleted...
|
by: JustSomeGuy |
last post by:
I have a string that looks like:
"123.45:123.45"
I am using sscanf "%f%*c%f" to extract the two floats and ignore the colon.
However there may be more than two floats....
Is there perhaps a...
|
by: Bob |
last post by:
I'm having trouble the string.Format() throwing exceptions and I can't figure
out what I am doing wrong.
Given the following setup code:
string str = { "one", "two", "three", "four" };
double...
|
by: Joah Senegal |
last post by:
Hello all,
I'm trying to print a string on my screen... But the string comes from a
variable string... This is the code
#include <cstdlib>
#include <iostream>
#include <string>
using...
|
by: Ciaran |
last post by:
Hi can someone give me hand with this please?
What's the best way to extract the extension from the url?
example:
$string="http://www.domain.co.uk/anypage.html"
In this example, I'd be...
|
by: nico |
last post by:
Hi,
I need to do a lot of string formating, and I have strings and/or
unicode strings and when I do the following:
"%s %s" % (u'Salut', 'H\xe4llo'), I get an exception :
UnicodeDecodeError:...
|
by: nine72 |
last post by:
Ok, so I have figured out how to parse an custom returned XML doc (actually a string that I made into a doc for testing).
At this point I am attempting to integrate my parse routine into my main...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
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$) {
}
...
|
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
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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: 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...
| |