Convert Double to String without zeros at the end
Hello,
how can i convert a double-numeric to a string? I know how can do it but not how i can do it in a fast way.
When i use the "Number to Fractional String"-Object then a number
1,2 --> is canged to 1,200000
1,0 --> changed to 1,000000
what can i do that there are no zeros at the end?
Currently i´m reading the reversed string in a loop to remove the zeros, but this i to slow i think.
Is there a fast way?
Thanks for your help
Extract from the LV help :
Select Tools»Options to display the Options dialog box and select
Front Panel from the Category list to display
this page.
Use this page to set front panel options.
This page includes the following components:
Open the control editor with double click—Allows you to
double-click a control to display the Control
Editor window. Use the Control Editor window to customize
the appearance of a front panel object. This checkbox is unchecked by default.
Use localized decimal point—Uses the decimal separator for
the operating system instead of the period. This checkbox is checked by default.
Remove the checkmark from this checkbox if you want LabVIEW to use periods in
all cases for the decimal point.
Similar Messages
-
Converting Double to String without exponent
Hi all,
I am reading some values from Excelsheet using apache POI library. I have large numbers that need to stored into database as string and not numbers. hence, while reading the excelsheet values, i convert these number.. and the are received as double. While converting double into string I noticed that some values are represented in exponential form.. I would like to avoid this and have pure number values in the form of string,,..
Can anybody tell me how to do it?
Thanks in advance,
Abdel Olakarajava.text.DecimalFormat
-
I'm having a problem in getting my double to convert to a string, here's my code so far.
public void calculatePayments()
double paymentAmount;
double monthlyInterestRate = (Double.parseDouble(interestBox.getText())/12)/100;
double amountOfLoan = Double.parseDouble(balanceBox.getText());
double numberOfPayments = Double.parseDouble(yearsBox.getText()) * 12;
paymentAmount = (amountOfLoan * monthlyInterestRate) / (1 - Math.pow(1/(1 + monthlyInterestRate),numberOfPayments));
Double.toString(paymentAmount);
tableBox.append(paymentAmount);
And here's the error message I get:
ProgramInterface.java:134: append(java.lang.String) in javax.swing.JTextArea cannot be applied to (double)
tableBox.append(paymentAmount);
As always, help is appreciated.This line returns a String but has no affect on paymentAmount.
Double.toString(paymentAmount);To covert the double to String you can save the return in a variable
String s = Double.toString(paymentAmount);
tableBox.append(s);or combine them
tableBox.append(Double.toString(paymentAmount)); -
I am looking for a way to convert double to String.
I think that I have to use wrapper like Double class and use toString(double d), but I am not sure how to do it.
Since toString() is static method, I do not have to have an instance of the Double class, so I was wondering what's the correct way to do it.
I need something like this:
String MyString = new String (String1.concat ( My_doubleNumber.Double.toString() ) );
Any Suggestions?
Thanks!!!WOW thanks a lot. These are definately better than what I thought of doing originally.
In case I need to use the wrapper class somewhere else, I am just wondering what would be a proper use of Double and String? -
Hi,
How can I add some zeros in the end of a field in the decimal places?
I need to have 6 decimal places, so which ever decimal place is not filled, should be filled with zeros.
Example:
If the value is 11.123
I need to convert it to 12.123000
If the value is 11.1
I need to convert it to 11.100000
Please let me know how can I do this conversion or whether there is any function module available for this.
Thanks,
UmaHi,
move the value field into character field.
then do like the below.
data:num(20) type c value '11.1',len type i,len2 type i,v1(10) type c,v2(10) type c.
split num at '.' into v1 v2.
len = strlen( v2 ). <b><<holds the value after decimal point,check the length, if it is less than 6 digits,
then append the reqd. no. of zeroes at the end>></b>
len2 = 6 - len.
do len2 times.
concatenate v2 '0' into v2.
enddo.
write:/ v2.
regards,
sowjanya -
Add Zeros at the Ending to make Length 20.
Hi,
I have a Target field WBS where the length should be always 20. If the length is less than 20, I shd add Zeros at the ending to make the length as 20. I think format Number cant be used in this case. Do I need to write a UDF or Is there any standard function
Thanks & Regards,
VarunHi Varun,
use this UDF:
StringBuffer sb = new StringBuffer();
int length = 20 - a.length();
for(int i=0;i<length;i++)
sb.append("0");
return sb.insert(0,a).toString();
The difference to the solution is the use of the StringBuffer class. This is better coding practice. Strings in java are immutable and concatenation of strings therefore very expensive.
Regards Sven -
Deleting Zeros at the end of fields in ALV report
I want to make an ALV report that include both integer and decimals in same column.
for example :
1 - 1234.0000
2 - 0.0027
i dont want to see zeros at the end of value.
But the type will be decimal and integer values will be shown with zeros at the end.
For Ex.
I want to take report like this ;
1 - 1234
2 - 0.0027
How can i make this?
Thanks.
Edited by: aydnbk on May 14, 2010 3:22 PMHello aydnbk.
As far as i know, there is no way to do what you want using standard ALV-Functions. There is a field 'DECIMALS' in structure LVC_S_FCAT, but using this field you could only define ONE setting, that would affect ANY value.
Furthermore i am asking myself, if this feature is really sensible - when numbers are right-justified, a global setting for the number of decimals makes it much easier to compare the values - at least this is my personal opinion...
If i had to do this trick, i would simply add some character fields to the output-structure and write the values to the charater-fields to enforce this quite special layout.
Additionally i would set the fields 'NO_OUT' and 'TECH' for the fields of type 'P', that are holding the values - 'NO_OUT' hides the column and 'TECH' ensures, that the field can not be selected in a user-defined layout.
Hope this helps.
Regards, Jörg -
Closing the IC web without first hitting the "END CONTACT" button
Hi ,
I am working on CRM 2007. We have a tricky problem with call detail records left in an inconsistent state (CRMD_TM_IACT-LOCK_STATE = E) when closing the IC web without first hitting the "END CONTACT" button .
any one face this kind of problem ? and what kind of solution we can implement .
is there any event which trigger when we click on IC WEB CLOSE button . because if we have any event triggered at that time then we can remove this lock ...
Thanks,
JackThanks for your suggestion! Creating a new profile and adding everything step by step was my last resort but I wasn't that desperate yet
Anyway, just if people would encounter the same problem, I solved the problem by changing the javascript ic_base_contextarea_scripts.js and cleared myself the contact information box variables when the end contact button was clicked.
I added following lines to the function wsb_handler(event) at the context
if(value=="End"){
closeLTXFrames();
forwardCall(cAppEventCode,cAppEvtReqEndInt,"","","","","","","","","");
contextArea.ContactDisplay.setContactName( '' );
contextArea.ContactDisplay.setCompanyName( '' );
contextArea.ContactDisplay.setContactType( '' , '' );
Kind regards,
Joost -
Just moved to Jakarta, Indonesia from the US with my new iMac. Do I need to plug the iMac into a converter or just put an adaptor on the end of the existing plug?
http://bali.angloinfo.com/information/housing/setting-up-home/electricity/
This, above, is a UK set of notes.
Your iMac is made to operate on anything between 100 and 250v. Indonesia is generally 220v so you will only need an adapter but beware; the power supply is not terribly reliable. Out of interest, your iMac cannot be iOS 7.1.2. Go to 'about this mac' and find the actual version number to enter in your profile. -
How to add zero at the end of a character string
Hello Experts,
I've a requirement where I need to do sum/total of various numbers and display it with $ sign as shown below.
I'm using a variable CHAR20 to display total with $ sign. The problem is if there is a 0 at the end of the total then variable doesn't display it as highlighted above in red. Can anybody please make suggestion ( a code sample will be great help ) how resolve this issue?
Many thanks in advance.Hi,
please check this code:
REPORT ztestcurr.
DATA: xv_prval TYPE char20.
DATA: xv_val1 TYPE dmbtr VALUE '12.67'.
DATA: xv_val2 TYPE dmbtr VALUE '8.21'.
DATA: xv_val3 TYPE dmbtr VALUE '13.72'.
DATA: xv_sum TYPE dmbtr.
START-OF-SELECTION.
xv_sum = xv_val1 + xv_val2 + xv_val3.
PERFORM print_val USING xv_val1.
PERFORM print_val USING xv_val2.
PERFORM print_val USING xv_val3.
PERFORM print_val USING xv_sum.
*& Form PRINT_VAL
* Print value
* --> XF_VALUE Value to print
FORM print_val USING xf_value TYPE dmbtr.
WRITE xf_value TO xv_prval CURRENCY 'USD'.
CONCATENATE '$' xv_prval INTO xv_prval.
CONDENSE xv_prval NO-GAPS.
write /1 xv_prval using edit mask 'RR____________________'.
ENDFORM. " PRINT_VAL
Regards,
Klaus -
Hi to all,
while migrating from NW to OES, one clustered volume with one (and
always the same) folder is duplicated with an trailing zero at the
folders name.
Source is
USER:\Abteilung\Edv\
Destination is
/media/nss/USER/Abteilung/EDV0/
while
/var/opt/novell/migration/user2/log/filesystem.success.log
shows the correct destination
Copying USER:Abteilung/EDV/... to /media/nss/USER/Abteilung/EDV/...
But in fact a new folder ../EDV0/ (in capitals) ist created, even if the
folder ../Edv/.. exists. This behaviour ist just with this folder, all
other volumes and folders worked fin.
One thing here is special:
I have *copied* the files to the destination volume because of the need
to have loaded tsafs.nlm, which nback will use for miggui, with the
option /nocluster for IBM TSM purposes. After that, I triggered a
regular consolidation as described above and later I plan to synch files
and trustees using miggui.
Any hints on that silly thing?
TIA
TomOriginally Posted by mrosen
Tom,
On 04.03.2013 09:17, bwisupport wrote:
> But I think, your questions led me to the solution:
> The destination folder, copied with TotalCommander, was named 'Edv' (as
> TC shows the sources name too). Miggui sees a source called EDV, and at
> the destination a folder called 'Edv' and decides that these are two
> different folders. Because it is not possible having to folders with the
> same name (despite capitals) at the same place, a new Folder with
> trailing zero is created.
>
> I've deleted the 'EDV0', renamed the destination to EDV (cross-checked
> with Explorer and CLI) and restart a synch.
Hmmmm.... Something's very strange here anyways. Miggui *should* not
care about the case when the destination is NSS set to long namespace.
Either there's a bug in your version of miggui, or something else is
weird about that folder. It's also strange that TC and Windows Explorer
disagree on the capitalization. That again would lead me to the
assumption that something's broken originally with the source, like the
DOS and LONG namespaces on the source disagreeing somehow.
CU,
Massimo Rosen
Novell Knowledge Partner
No emails please!
Untitled Document
It sorta does. Apparently there's a bug in the miggui code that does this (although we only have it happen on OES2 SP3 to OES11 and it doesn't add a "0" at the end, it just stops processing after the main directory).
I've been waiting for NTS to file a bug report for over a month now.
anyway, Ramesh (the guy who kinda owns miggui) acknowledged there's a bug.
You can either:
1) use the migfiles command apparently instead of miggui
or
2) Rename the directory so that it matches, but with NSS you'll have to rename it twice. Like:
EdvX and then again to: EDV
Problem is with nbackup apparently that miggui uses. -
How to read a time stamp from the db without ".0" at the end
Hi All,
I have code that is saving the results of a query in a result set.
When ever i read a time stamp from the db (mysql 4) it always adds ".0" to the end of it.
I tried using the getTimeStamp, getDate, getString methods for result sets and was not able to resolve the issue.
Am i missing something here?
Thankshere is the code
public static Table executeSelect(Connection conn, String qry)
throws SQLException {
Statement stm = null;
ResultSet rs = null;
try {
stm = conn.createStatement();
rs = stm.executeQuery(qry);
Table t = new Table(rs);
return t;
} finally {
close(null,stm,rs);
Basically the user is asked to enter the query and the connection settings and then i retrieve the data and return a table.
Now if i try to print the value of the time stamp from the result set it adds a a .0
So for example if am running the following
select mod_ts from temp limit 1;
| mod_ts |
| 2007-12-28 09:32:58 |
1 row in set (0.00 sec)
When i print the value of the time stamp it gets printed as 2007-12-28 09:32:58.0
The following code is used to generate a table from the result set
public Table(ResultSet rs) throws SQLException {
ResultSetMetaData rsmd = rs.getMetaData();
int colCount = rsmd.getColumnCount();
colNames = new String[colCount];
colTypes = new int[colCount];
for ( int i=0; i<colCount; i++) {
String colName = rsmd.getColumnName(i+1);
colNames[i] = colName;
int colType = rsmd.getColumnType(i+1);
colTypes[i] = colType;
while ( rs.next()) {
if ( data == null) {
data = new ArrayList<List>();
List<Object> row = new ArrayList<Object>();
for ( int i=0; i<colCount; i++) {
Object ob = rs.getObject(colNames);
row.add(ob);
data.add(row);
Now when i print the values in the result set it adds a .0 to the end of the time stamp
I also tried using getTimeStamp for a result set and the same problem still existed -
How do I sign multiple fields in a pdf without saving untill the end?
I have Acrobat 9 and I am trying to put in 20-50 signature fields all to be signed by the same person in one to however many sittings. For every signature it prompts to "Save As". I work in the medical field so all our training is tied up in medical topics plus computers are not the favorite but needed medium. I need it to sign with only a quick prompt to agree to sign for each one then save to the same pdf or save as if decided after the person is done signing what they need for that day. After all signatures are signed a final ending one to lock all the rest would be nice. The signatures are replacing initials for training topics with the final being the "I have been training to proper levels and agree to the assessment" kind of statment. So this thing can't be signed in one day but multiple have to be signed in one sitting with some ease if anyone is to use it. I would real like to get this thing going if anyone can help.
I hate to say it, but adding 20-50 signatures to a document isn't efficient, and by that I mean Acrobat doesn't handle that many signatures efficiently. Part of the problem is Acrobat must verify each digital signature separately and it will end up slowing things down for you (and by slowing things down I mean effectively locking up the computer). Every time you add another signature Acrobat validates all of the previous signatures to ensure the document integrity for the signature being created. Also, every time the file is opened each signature would get verified.
That said, you could (and this is only a suggestion) author the file using checkboxs and then using one digital signtaure at the end of the process that locks the file so the checkboxes can't be changed
Steve -
How to make cash account balance Zero at the end of the year
Hi,
We have one account 200180 with 1000 Company code( Germany), and document currency is HKD(Hong kong Dollor), but LC is Euro and it is a cash account. At the end of the year, this account shows 0 balance in HKD, and 10,000 in Euro. I understand that it is because of difference in exchange rates every month. Shall I include this account in foreign currency valuation ? Any other way to make the balance is 0 in Euro?
RKHi men,
I think tcode F-05 can solve your problem. You should make some adjustment by using this tcode.
Good luck. -
Newbie Converting double to string
I am very new to Java Programming, but I am trying to convert a double to a string
Here is some code of what I am trying to do:
String output = "";
Word words[] = new Word[ 7 ];
Then I add the "words" to the array
for ( int i = 0; i < words.length; i++ ) {
output += words[ i ].toString();
output +="\nListed :" + Double.toString(words[ i ].listings()) + "\n";
return output; the listings method is type double. I think I can use toString to convert a double to a string but am not sure how to go about doing it.
Any help is very appreciated.
Thanks.I am very new to Java Programming, but I am trying to
convert a double to a string
Here is some code of what I am trying to do:
String output = "";
Word words[] = new Word[ 7 ];
Then I add the "words" to the array
for ( int i = 0; i < words.length; i++ ) {
output += words[ i ].toString();
output +="\nListed :" + Double.toString(words[ i
].listings()) + "\n";
return output;the listings method is type double. I think I can use
toString to convert a double to a string but am not
sure how to go about doing it.
Any help is very appreciated.
Thanks.Wrong:
Double.toString(words[ i ].listings())
Right:
words[ i ].listings().toString()
Maybe you are looking for
-
ALV change layout button in toolbar
Hi, I have an ALV,which has a change layout option in its toolbar.I want to save layouts which r user specific.Please help me with this isse. Thanks
-
Hi everyone. I am new to the forums, so let me be as mprecise as possible. i know the basic functionalities of Labview with MPC block etc. However, i dont know how to go ahead with implementing MPC control for a system whose state space model i posse
-
Can I use Variable Offsets or Formula definition for my problem?
Hello, how can i get my BEx report to show me cash weeks 28 to 35 when i enter 27 as the variable selection? What i need are the next 8 weeks ahead of the week that i entered. Thanks, SD
-
HP Mini 1000, Windows 7, trackpad not working
Hi all, I decided to format my Mini this morning to install a legal OEM copy of Win7 Pro. The first thing I noticed was there was no mouse cursor during the installation - not a big deal because I used a USB mouse. However, in Windows, the trackpad w
-
So I have downloaded several songs (they have downloaded completely) and noticed while playing the songs they just stop mid song or with 10 seconds left they abruptly cut off. This is not how the song was recorded. I like the songs and want them but