formatting

Fortran decimal and thousand separator

自作多情 提交于 2020-01-05 15:05:31
问题 Is there a way to change the period decimal separator for a comma?. Also, how can I make the output numbers have a thousand separator?. This could be a comma, a period, a space ... 回答1: You can write a C++ function which will convert the number in a string in you current locale for you. #include <string> #include <iomanip> #include <sstream> class SpaceSeparator: public std::numpunct<char> { public: SpaceSeparator(std::size_t refs): std::numpunct<char>(refs) {} protected: char do_thousands

Export HTML table to XLS and retain formatting

核能气质少年 提交于 2020-01-05 08:44:10
问题 I would like to export a HTML table to XLS and at the same time retain all formatting. The following code seems to be working, except that the hilight is lost on export. How do I keep it in place? <html> <head> <title>TODO supply a title</title> <meta charset="UTF-8"> <script src="http://code.jquery.com/jquery-1.9.1.js"></script> </head> <body> <div id='data'> <table border='1'> <tr> <td> <strong>Greeting</strong> </td> <td> <strong>Message</strong> </td> </tr> <tr> <td> Hello </td> <td>

Eclipse Java code formatting

微笑、不失礼 提交于 2020-01-05 07:12:22
问题 I'm writting a GUI program. It has several JPanels that conatin other components. It would be really nice if my code would look like this: parent component code child component code grandchild component code instead of this: parent component code child component code grandchild component code It would make the code far more readable. Is(Are) there some character(s) I can put in my code that Java will ignore, but Eclipse would detect it as a part of code that has to have additional indentation

Eclipse Java code formatting

不想你离开。 提交于 2020-01-05 07:12:10
问题 I'm writting a GUI program. It has several JPanels that conatin other components. It would be really nice if my code would look like this: parent component code child component code grandchild component code instead of this: parent component code child component code grandchild component code It would make the code far more readable. Is(Are) there some character(s) I can put in my code that Java will ignore, but Eclipse would detect it as a part of code that has to have additional indentation

How is right to format and validate edit control to accept only float or currency values

五迷三道 提交于 2020-01-05 04:30:18
问题 I have a application that needs to accept float or currency values in edit control. My question is what I must to do to format and validate edit controls input so it accepts only numbers, comma or dot (comma or dot depends on system locale). And the formatting is ##.## (45.21). I want to do one method that can control all edit controls wehre float formatting and validating is used. Right now I have code in OnChange event that uses TryStrToFloat method, but sometimes I get "'' is not floating

How to format date in listing page

白昼怎懂夜的黑 提交于 2020-01-05 04:14:07
问题 I am new to Yii framework and just started to work on an existing website. I have a listing page and my requirement was to add a new field 'review_date_time' and I could managed to display it in listing. Now my question is how to change the format of the date and how to show a white space if date is not there in table field.Right now it is displaying 0000-00-00 00:00:00 if no date is there. My code for listing $this->widget('zii.widgets.grid.CGridView', array( 'id' => 'series-grid',

Formatting Java Output Like a Table

♀尐吖头ヾ 提交于 2020-01-05 02:36:06
问题 I am attempting to output information regarding students stored by my program in a tabular-like format as \t does not always provide the correct spacing. In order to do so, I came across this question and have attempted to enable a similar solution. However, I am obtaining errors with the format lines in my code when I attempt to execute it as such. public void displayStudents (){ System.out.println ("\n-----------------------------"); System.out.println ("Email System - Display Students");

PHP strptime format bug?

十年热恋 提交于 2020-01-05 01:41:14
问题 I am wrestling with a php 5.2.6 problem. An api we use returns dates in this format DDMMYYYYHHMM. Exactly that format, fixed length, no delimiters. However, in my experimentation, this format seems to break strptime, which returns a false (fail) when I feed it a date in this format. It can reproduced, at least on my system, with this example: $format = "%d%m%Y%H%M"; echo print_r(strptime(strftime($format,1225405967),$format),true); If I add any character between the date and the time, it

Plot of minute tick data with correct x-axis formatting?

元气小坏坏 提交于 2020-01-04 18:20:07
问题 I want to plot tick data on a minute-basis. My dataframe looks like the following: > head(df) No Date Time Close Volume Weekday 1 3361 03.12.2012 08:00:00.000 7.435 27000000 Montag 2 3362 03.12.2012 08:01:00.000 7.428 47000000 Montag 3 3363 03.12.2012 08:02:00.000 7.428 41000000 Montag 4 3364 03.12.2012 08:03:00.000 7.429 39000000 Montag 5 3365 03.12.2012 08:04:00.000 7.426 44000000 Montag 6 3366 03.12.2012 08:05:00.000 7.423 49000000 Montag > Now I want to plot the first 241 entries, with

C++ decimal output formatting

寵の児 提交于 2020-01-04 15:28:59
问题 i'm writing a double value to a file. The numeric value is written with a point as a decimal separator. I would like to use a comma. How i can do that? 回答1: The usual way is to use a locale with the decimal separator set to the comma. If your machine is configured for that generally, you can probably just use the nameless locale for it: std::cout.imbue(std::locale("")); std::cout << 12345.67; 回答2: You can find the answer in an earlier question This basically changes the locale used by the