I'm about to convert to string and use regex, but I thought there must be
something I'm missing here that already exists.
Bob 15 20103
use the re expression in a Format
MyStr = Format(5459.4, "##,##0.00" ) ' Returns "5,459.40".
--
Regards - One Handed Man
Author : Fish .NET & Keep .NET
=============== =============== ===========
This posting is provided "AS IS" with no warranties,
and confers no rights.
"Bob" <no*****@nospam .net> wrote in message
news:eV******** *******@tk2msft ngp13.phx.gbl.. . I'm about to convert to string and use regex, but I thought there must be something I'm missing here that already exists.
Bob
Please explain to me how this can be applied as a general solution.
"One Handed Man" <te************ *************** @BTOpenworld.co m> wrote in
message news:%2******** ********@tk2msf tngp13.phx.gbl. .. use the re expression in a Format
MyStr = Format(5459.4, "##,##0.00" ) ' Returns "5,459.40".
-- Regards - One Handed Man
Author : Fish .NET & Keep .NET =============== =============== =========== This posting is provided "AS IS" with no warranties, and confers no rights.
"Bob" <no*****@nospam .net> schrieb I'm about to convert to string and use regex, but I thought there must be something I'm missing here that already exists.
Could you please give us an example of which values have to be formatted
how?
--
Armin
Okay, I think I got it.
Function RemoveTrialingZ eros(ByVal dec As Decimal) As Decimal
Return CDec(CSng(dec))
End Function
Bob
"Bob" <no*****@nospam .net> wrote in message
news:eV******** *******@tk2msft ngp13.phx.gbl.. . I'm about to convert to string and use regex, but I thought there must be something I'm missing here that already exists.
Bob
324.0000 -- 324
324.0100 -- 324.01
324.0001 -- 324.0001
"Armin Zingler" <az*******@free net.de> wrote in message
news:OX******** ******@TK2MSFTN GP09.phx.gbl... "Bob" <no*****@nospam .net> schrieb I'm about to convert to string and use regex, but I thought there must be something I'm missing here that already exists.
Could you please give us an example of which values have to be formatted how?
-- Armin
"Bob" <no*****@nospam .net> schrieb 324.0000 -- 324 324.0100 -- 324.01 324.0001 -- 324.0001
The type of the values in the left column is not Decimal, it is String.
There are no trailing zeros in Decimals. The default behavior is that there
are *no* trailing zeros when converting a Decimal to a String, that's why I
don't understand the question:
Dim d As Decimal
d = 324D
MsgBox(d.ToStri ng) 'returns "324"
d = 324.01D
MsgBox(d.ToStri ng) 'returns "324.01"
d = 324.0001D
MsgBox(d.ToStri ng) 'returns "324.0001"
--
Armin
Hello,
"Bob" <no*****@nospam .net> schrieb: 324.0000 -- 324 324.0100 -- 324.01 324.0001 -- 324.0001
Is that contained in a string like "bla foo baz 342.0000 bar baz foo 234.02
bla"?
Regards,
Herfried K. Wagner
--
MVP · VB Classic, VB.NET http://www.mvps.org/dotnet
Okay, you got me. It's for when I'm displaying the decimal value as a string. I
have some data being returned that comes back as datatype decimal that always
trails with 4 zeros even if the value is integer. I just wanted to chop off the
unnecessary zeros and thought a ...
oh hell.
Here it is.
Dim foo As Decimal = CDec("1.0100")
MsgBox(Format(f oo, "#.####"))
thanks for kicking my brain into gear.
Bob
"Armin Zingler" <az*******@free net.de> wrote in message
news:%2******** ********@TK2MSF TNGP09.phx.gbl. .. "Bob" <no*****@nospam .net> schrieb 324.0000 -- 324 324.0100 -- 324.01 324.0001 -- 324.0001
The type of the values in the left column is not Decimal, it is String. There are no trailing zeros in Decimals. The default behavior is that there are *no* trailing zeros when converting a Decimal to a String, that's why I don't understand the question:
Dim d As Decimal
d = 324D MsgBox(d.ToStri ng) 'returns "324"
d = 324.01D MsgBox(d.ToStri ng) 'returns "324.01"
d = 324.0001D MsgBox(d.ToStri ng) 'returns "324.0001"
-- Armin
Sorry i didnt get back sooner, bu you saw the light anyway.
Well done
--
Regards - One Handed Man
Author : Fish .NET & Keep .NET
=============== =============== ===========
This posting is provided "AS IS" with no warranties,
and confers no rights.
"Bob" <no*****@nospam .net> wrote in message
news:e6******** ******@tk2msftn gp13.phx.gbl... Okay, you got me. It's for when I'm displaying the decimal value as a
string. I have some data being returned that comes back as datatype decimal that
always trails with 4 zeros even if the value is integer. I just wanted to chop
off the unnecessary zeros and thought a ...
oh hell.
Here it is.
Dim foo As Decimal = CDec("1.0100") MsgBox(Format(f oo, "#.####"))
thanks for kicking my brain into gear.
Bob
"Armin Zingler" <az*******@free net.de> wrote in message news:%2******** ********@TK2MSF TNGP09.phx.gbl. .. "Bob" <no*****@nospam .net> schrieb 324.0000 -- 324 324.0100 -- 324.01 324.0001 -- 324.0001
The type of the values in the left column is not Decimal, it is String. There are no trailing zeros in Decimals. The default behavior is that
there are *no* trailing zeros when converting a Decimal to a String, that's
why I don't understand the question:
Dim d As Decimal
d = 324D MsgBox(d.ToStri ng) 'returns "324"
d = 324.01D MsgBox(d.ToStri ng) 'returns "324.01"
d = 324.0001D MsgBox(d.ToStri ng) 'returns "324.0001"
-- Armin This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Raymond Arthur St. Marie II of III |
last post by:
very Very VERY dumb ? about the new Set( ) 's
Please be kind and read this like you know I've been up 33-34 hours reading
PEP's but...
Doc\ref 2.6 Delimiters show's three unused characters "@ $ ?".
@ sort of looks like and sort of sounds like a set an
$ well sort of obvious.
I can imagine that the $ would be confused for money and @ is ugly.
|
by: J. W. McCall |
last post by:
Sorry if this is OT, but here's my question:
I wrote a simple python script to increment a counter in a text file,
and I wanted this script to be accessed whenever an HTML file is
accessed. The HTML files and python script are on a shell account on
UNIX a machine that has support for CGI, Python, etc. I unfortunately
don't know much about CGI, since I assume this is what I need to get
this to work. All I want to do is to get script to...
|
by: Marcus Smaby |
last post by:
With the rich IDE on VB.net 2003, I was wondering if there is an easy way to
set the event handler function for a hand-coded object (SqlConnection for
example). I know that if I dim it withevents I can use the drop-down to
insert the event-handler template. But if I am not using the withevents, but
instead wiring things with the addhandler command, is there a way to get the
template inserted? Right now I am putting a 'dim withevents ........
|
by: InvisibleMan |
last post by:
Hi, I feel a little dumb for asking this (considering im writing
TSQL) but there doesn't seem to be any definitive answers on the
search engines...
Okay I understand that if you open the ADO connection that you
close it with:
adoCon.Close
Set adoCon = Nothing
|
by: Bob Stearns |
last post by:
I have a (somewhat complicated) query that returns the rows from a table
and its self join in the correct order. I want to call a procedure on
each of the returned rows, in the order returned. Is there any to do
this in straight sql or must I write an sql procedure with a cursor on
the select and issue the call while accessing rows through the cursor?
What I'm trying to do (as those of you that follow comp.databases.theory
will remember)...
| |
by: TGF |
last post by:
How do you copy a String type into a native char buffer? Dumb
question, but not sure how to do it :(
TGF
|
by: Need Help |
last post by:
This might be an extremely dumb question; I'm new to Visual C++, and am trying to use the simple Spooler API, OpenPrinter, but when I try to compile my source file, it says OpenPrinter is an undeclared identifier. Here's how I'm trying to use it
HANDLE newPrinter = NULL
BOOL op = OpenPrinter(ps09, &newPrinter, NULL)
Now, as far as I'm concerned there should be nothing wrong with that code, but does anyone else know what might be the...
|
by: Stelrad Doulton |
last post by:
Hi,
Apologies if this isn't the correct forum. I am writing a communication
solution (actually on the Compact Framework) based on HttpWebRequests
hooking up with custom handlers on the server side. My dumb question is
this: how reliable is http? For example if I use PUT and call GetResponse on
my request object with no problem, can I guarantee that every byte of my
file will always arrive at the web server?
|
by: vashwath |
last post by:
#include <stdio.h>
int main()
{
FILE *fp;
char s;
fopen("file.txt","w+");
fprintf(fp,"HI\n");
|
by: Rudy |
last post by:
Hi All!
A real dumb question, but should be easy, I hope.
I created a custom message box, by creating a form. I just want a "OK"
button on the message box to close the message box out. I tried close, but it
doesn't work.
How do I close this message box?
Thanks!
Rudy
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |