formatting

Python string formatter for paragraphs

时光总嘲笑我的痴心妄想 提交于 2020-01-02 05:59:23
问题 I'm trying to format some strings for output on the command-line, report style, and am looking for the easiest method to format a string such that I can get automatic paragraph formatting. In perlform formatting is done through the "format" function format Something = Test: @<<<<<<<< @||||| @>>>>> $str, $%, '$' . int($num) . $str = "widget"; $num = $cost/$quantity; $~ = 'Something'; write; Variations of the perlform allow texts to be wrapped cleanly, useful for help screens, log reports and

Python string formatter for paragraphs

泪湿孤枕 提交于 2020-01-02 05:59:09
问题 I'm trying to format some strings for output on the command-line, report style, and am looking for the easiest method to format a string such that I can get automatic paragraph formatting. In perlform formatting is done through the "format" function format Something = Test: @<<<<<<<< @||||| @>>>>> $str, $%, '$' . int($num) . $str = "widget"; $num = $cost/$quantity; $~ = 'Something'; write; Variations of the perlform allow texts to be wrapped cleanly, useful for help screens, log reports and

How to convert row to column in notepad++

牧云@^-^@ 提交于 2020-01-02 05:25:14
问题 How can I convert testext to t e s t e x t Please note there is no delimiter. Is there any way? 回答1: Go to Search → Find → Replace (Ctrl+F) and type following: Find: (.) Replace: $1\n SearchMode: Regular Expression Direction: Down Then place the caret at the beginning of the text and hit "Replace All". 来源: https://stackoverflow.com/questions/29259799/how-to-convert-row-to-column-in-notepad

How to format R Shiny numericInput?

妖精的绣舞 提交于 2020-01-02 05:22:07
问题 I have a Shiny app with numerous numericInput fields. I would like a way to format the numericInput fields with commas separating every 10^3. For example, I want 5,000,000 instead of 5000000. I can do this in R with the format and prettyNum functions. But I don't have a way to do this in Shiny. This would be very helpful for the UI because it would work with percents, money, etc. Does anyone have any idea how to incorporate this into the numericInput field? Thanks! library(shiny) # Define UI

how to add thousands separator to a number that has been converted to a string in python?

北城余情 提交于 2020-01-02 05:17:11
问题 in my scenario (python 2.7), i have: str(var) where var is a variable that sometimes requires thousands separators eg 1,500 but as you can see has been converted to a string (for concatenation purposes). i would like to be able to print out that variable as a string with thousands separators. i have read solutions for adding formatting to a number eg: >>> '{:20,.2}'.format(f) '18,446,744,073,709,551,616.00' from https://stackoverflow.com/a/1823189/1063287 but this seems to be applicable just

Crystal Report showing HTML text, but the bullets don't show. Why?

谁都会走 提交于 2020-01-02 03:27:15
问题 I'm getting data out of a SQL-Server nvarchar(3000) field, which is formatted as html, displaying it in Crystal Reports 11. The data is being saved as bullets, and if I pull out the data and drop it in a text file with an html extension, it shows the bullets. But from Crystal, it does not. I get the new line, but no bullets. The field that is saved looks like this: <HTML><BODY><DIV STYLE="text-align:Left;font-family:Tahoma;font-style:normal;font-weight:normal;font-size:11;color:#000000;"><DIV

Word-wrapping comments in Netbeans

主宰稳场 提交于 2020-01-02 01:46:28
问题 /* * * This is a long comment. I broke it into lines, but that made it impossible to edit without screwing up the formatting. Is there a way to make Netbeans add line breaks automatically? * */ Reads: This is a long comment. I broke it into lines, but that made it impossible to edit without screwing up the formatting. Is there a way to make Netbeans add line breaks automatically? 回答1: As for today, the current NetBeans (7.3) word-wraps comments with some nice available extra options when

Is it possible to use String.format for a conditional decimal point?

孤者浪人 提交于 2020-01-02 01:18:08
问题 In java, is it possible to use String.format to only show a decimal if there is actually a need? For example, if I do this: String.format("%.1f", amount); it will format: "1.2222" -> "1.2" "1.000" -> "1.0" etc, but in the second case (1.000) I want it to return just "1". Is this possible with String.format, or am going to have to use a DecimalFormatter? If I have to use a decimal formatter, will I need to make a separate DecimalFormatter for each type of format I want? (up to 1 decimal place,

Print data frame with columns center-aligned

扶醉桌前 提交于 2020-01-01 12:32:08
问题 I would like to print a data frame where the columns are center aligned. Below is what I have I tried, I thought printing the data frame test1 would result in the columns being aligned in the center but this is not the case. Any thoughts on how I can do this? test=data.frame(x=c(1,2,3),y=c(5,6,7)) names(test)=c('Variable 1','Variable 2') test[,1]=as.character(test[,1]) test[,2]=as.character(test[,2]) test1=format(test,justify='centre') print(test,row.names=FALSE,quote=FALSE) Variable 1

Excel VBA - format a whole column excluding the heading line

与世无争的帅哥 提交于 2020-01-01 09:40:14
问题 I want to format a column but to exclude the first row as this is the header: My current Code is: Sheets("Sheet1").Columns(3).NumberFormat = "#,##0" Thank you. 回答1: Unless the header is a number you shouldn't need to do this, I don't think. The number format won't affect text (at least not much). But here's a way: With ThisWorkbook.Sheets("Sheet1") .Columns(3).Resize(.Rows.Count - 1, 1).Offset(1, 0).NumberFormat = "#,##0" End With 回答2: Alternatively Sheets("Sheet1").Range(cells(2,3), cells(2