473,387 Members | 1,455 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

str( number, width, presicion) function

How to implement function

string Str( float number, ushort width, ushort presicion)

should return string whose size if width characters, left padded by spaces
and having presicion characters after decimal point using current culture
decimal
separator.

Andrus

Apr 22 '07 #1
3 1422
Andrus wrote:
How to implement function

string Str( float number, ushort width, ushort presicion)

should return string whose size if width characters, left padded by spaces
and having presicion characters after decimal point using current culture
decimal
separator.

Andrus

You got a reply here:

http://www.codeproject.com/script/co...49#xx2000862xx

--
Göran Andersson
_____
http://www.guffa.com
Apr 22 '07 #2
You got a reply here:
>
http://www.codeproject.com/script/co...49#xx2000862xx
Göran,

thank you.
This recommends only to use Format() function.

Do you have any sample how to pass width and presicion to Format() function
?
Apr 22 '07 #3
Andrus wrote:
>You got a reply here:

http://www.codeproject.com/script/co...49#xx2000862xx
This recommends only to use Format() function.

Do you have any sample how to pass width and presicion to Format() function ?
Variable witdh and precision does not come natural for String Format,
but it is possible:

public static string Str(double number, ushort width, ushort precision)
{
return String.Format("{0," + width + ":f" + precision + "}", number);
}
Arne
Apr 22 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Tuxtrax | last post by:
Hi all. I have need of assistance on something that should be very simple, and is driving me absolutely batty. This is a code snippet from a short program that downloads news headers via...
0
by: harold fellermann | last post by:
Hi all, I am trying to write a script that prints out the signatures of each function call that occurs during the execution of a second script which is invoked by my program. i.e. if the...
1
by: A. Farber | last post by:
Hi, I'm trying to port a bigger program from Visual C++ to Linux and after rewriting few Visual C++ functions (strnicmp, filelength, findnext, etc.) I'm finally down to just one (!) error...
14
by: Stegano | last post by:
I am learning C Programming after working with Java for 5 years. I want to know where can I find the source files for C language itself. For example strcat is a function, which concatenates two...
0
by: nickyeng | last post by:
#include <iostream> #include <fstream> #include <string> #include <map> #include <iterator> using namespace std; void f(string str){ transform(str.begin(), str.end(), str.begin(),...
2
by: adima | last post by:
Hi All! Sorry, my English isnt good, but get a try to describe my problem. Today we wrote next script: import os, glob, time, string files_to_test = ( "J:\\BWNEW\\!Unerase\\test.test",...
3
by: Ge Chunyuan | last post by:
hi Group: Once use ActivePython latest version for Python 2.5.1. I happened to find function "str" is not callable, but it is available for Python 2.5. Can anybody give some comments about it?...
11
by: davidj411 | last post by:
i am parsing a cell phone bill to get a list of all numbers and the total talktime spend on each number. i already have a unique list of the phone numbers. now i must go through the list of...
19
by: est | last post by:
From python manual str( ) Return a string containing a nicely printable representation of an object. For strings, this returns the string itself. The difference with repr(object) is that...
0
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$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
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,...
0
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...
0
Oralloy
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,...
0
jinu1996
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.