text-formatting

How to know the preferred display width (in columns) of Unicode characters?

两盒软妹~` 提交于 2019-11-29 21:53:23
In different encodings of Unicode, for example UTF-16le or UTF-8 , a character may occupy 2 or 3 bytes. Many Unicode applications doesn't take care of display width of Unicode chars just like they are all Latin letters. For example, in 80 -column text, which should contains 40 Chinese characters or 80 Latin letters in one line, but most application (like Eclipse, Notepad++, and all well-known text editors, I dare if there's any good exception) just count each Chinese character as 1 width as Latin letter. This certainly make the result format ugly and non-aligned. For example, a tab-width of 8

How can I use the \\t [tab] operator to format a NSString in columns?

放肆的年华 提交于 2019-11-29 11:02:35
I would like to find a way to format a NSString like this: Name: John Location: Unknown Type: Unknown Status: Unknown Right now I'm using this code to do it but the result is quite different: The code: serializedValue = [serializedValue stringByAppendingFormat:@"%@:\t\t%@\n",title, value]; Where title is the left column and value is the second one. The result: Name: John Location: Unknown Type: Unknown Status: Unknown Now, as you can see, adding always a constant number of tabs (\t), 2 in my case, doesn't do the trick, because some words in the left column are longer and some are shorter. I'm

how to use “tab space” while writing in text file

扶醉桌前 提交于 2019-11-29 09:05:31
SimpleDateFormat formatter = new SimpleDateFormat("ddMMyyyy_HHmmSS"); String strCurrDate = formatter.format(new java.util.Date()); String strfileNm = "Cust_Advice_" + strCurrDate + ".txt"; String strFileGenLoc = strFileLocation + "/" + strfileNm; String strQuery="select name, age, data from basetable"; try { stmt = conn.createStatement(); System.out.println("Query is -> " + strQuery); rs = stmt.executeQuery(strQuery); File f = new File(strFileGenLoc); OutputStream os = (OutputStream)new FileOutputStream(f); String encoding = "UTF8"; OutputStreamWriter osw = new OutputStreamWriter(os, encoding)

Formatting console Output

我的未来我决定 提交于 2019-11-29 03:56:39
I'm having trouble making python print out texts properly aligned. I have tried everything I knew, but still the same result and it's very annoying!. Here is what I'm getting in the console Here is the Code I have. print " FileName\t\t\t\t\tStatus\t\tBinary Type\n" for files in PASS: log = subprocess.check_output(['dumpbin','/HEADERS',files]) if arch64 in log: print" %s \t\t\t\tPASSED\t\t 64-bit \t\t " %files elif arch32 in log: print" %s \t\t\t\tPASSED\t\t 32-bit \t\t " %files print"\n" for files in FAILED: print" %s \t\t\t\t FAILED \t\t " %files print "\n\n Use %45s to make a right justified

How do I get HTML Tidy to not put newline before closing tags?

大憨熊 提交于 2019-11-29 03:13:40
HTML Tidy has this infuriating habit of putting a newline before the closing tag. For example: <p>Some text</p> becomes <p>Some text </p> How do I tell Tidy to keep the closing tag on the same line as the end of the content? Btw, I am running Tidy through Notepad++, if that makes any difference. Make sure vertical-space is set to no . After much frustration I learned the only thing that switch does is screw up your already somewhat-nicely formatted html by adding newlines where you don't want them. This is what I use for minimally-invasive tidying (no adding doctypes/head tags, etc.): tidy

How to know the preferred display width (in columns) of Unicode characters?

我与影子孤独终老i 提交于 2019-11-28 17:44:49
问题 In different encodings of Unicode, for example UTF-16le or UTF-8 , a character may occupy 2 or 3 bytes. Many Unicode applications doesn't take care of display width of Unicode chars just like they are all Latin letters. For example, in 80 -column text, which should contains 40 Chinese characters or 80 Latin letters in one line, but most application (like Eclipse, Notepad++, and all well-known text editors, I dare if there's any good exception) just count each Chinese character as 1 width as

Strikeout text in Windows phone 7

眉间皱痕 提交于 2019-11-28 11:24:16
问题 Is there a way to strikeout text in windows phone 7? 回答1: Read this thread, someone also posted a solution there. 回答2: There is no built-in way to do this. The only alternative is to draw a line in the same position as the text yourself. 回答3: A little simple example: <Grid HorizontalAlignment="Left" VerticalAlignment="Top"> <Grid.RowDefinitions> <RowDefinition Height="1*"/> <RowDefinition Height="1*"/> </Grid.RowDefinitions> <TextBlock HorizontalAlignment="Left" TextWrapping="Wrap" Text="Some

How can I use the \t [tab] operator to format a NSString in columns?

妖精的绣舞 提交于 2019-11-28 04:18:24
问题 I would like to find a way to format a NSString like this: Name: John Location: Unknown Type: Unknown Status: Unknown Right now I'm using this code to do it but the result is quite different: The code: serializedValue = [serializedValue stringByAppendingFormat:@"%@:\t\t%@\n",title, value]; Where title is the left column and value is the second one. The result: Name: John Location: Unknown Type: Unknown Status: Unknown Now, as you can see, adding always a constant number of tabs (\t), 2 in my

What is the WPF XAML Data Binding equivalent of String.Format?

夙愿已清 提交于 2019-11-27 18:45:32
Or, to be more clear, how can I format a block of text (in my case, to be included within a tooltip) such that some portions of the text come from bound values. In plain C# I would use: _toolTip.Text = string.Format("{1:#0}% up, {2:#0}% down", Environment.NewLine, percentageOne, percentage2); However the WPF XAML markup for a Text property seems able to contain only a single binding. The curly braces gave me high hopes, but this isn't possible: <Element> <Element.Tooltip> <!-- This won't compile --> <TextBlock Text="{Binding Path=PercentageOne}% up, {Binding Path=PercentageTwo}% down"/> <

How do I get HTML Tidy to not put newline before closing tags?

跟風遠走 提交于 2019-11-27 17:26:56
问题 HTML Tidy has this infuriating habit of putting a newline before the closing tag. For example: <p>Some text</p> becomes <p>Some text </p> How do I tell Tidy to keep the closing tag on the same line as the end of the content? Btw, I am running Tidy through Notepad++, if that makes any difference. 回答1: Make sure vertical-space is set to no . After much frustration I learned the only thing that switch does is screw up your already somewhat-nicely formatted html by adding newlines where you don't