line-breaks

Android textview break line behaviour (how to split the last word)

风格不统一 提交于 2019-12-21 05:03:12
问题 I'm writing an apply that pops texts on the screen and usually it is longer than 1 line. If the last word of a line is too long to fit in it, textview would just put it at the beginning of the next line. Is there a way to modify this behaviour? When the last word is a long one the results are horrible. Basically I'd like to achieve something like this |Lorem ipsum dolor sit amet, consecte| |tur adipiscing elit. Lorem ipsum dol | |or sit amet, consectetur adipiscing | |elit. | Instead of what

What is the best way to break HTML text on slashes (/)?

无人久伴 提交于 2019-12-20 09:48:08
问题 I have an HTML table 360px wide, which works great. The challenge is that sometimes a url appears http://this/is/a/really-really-really-really-really/long/url in the text. This causes the table to expand horizontally and a scroll bar appears on the bottom. I don't think overflow:hidden will work because half of the text would be hidden. What is the best way to force breaking the line on slashes (/) and dashes (-) in CSS (hopefully)? It should work with IE7+, Chrome, Firefox and Safari.

Unicode regexp to match line-breaks?

只愿长相守 提交于 2019-12-20 03:03:56
问题 I have this form from where I want to submit data to a database. The data is UTF8. I am having trouble with matching line breaks. The pattern I am using is something like this: ~^[\p{L}\p{M}\p{N} ]+$~u This pattern works fine until the user puts a new line in his text box. I have tried using \p{Z} inside the class but with no success. I also tried "s" but it didn’t work. Any help is much appreciated. Thanks! 回答1: A Unicode linebreak is either a carriage return immediately followed by a line

How to save a text string with line breaks to a MySQL database text field using PHP?

痞子三分冷 提交于 2019-12-20 02:32:45
问题 In SugarCRM I have a Textarea field that I am trying to save data to with line breaks. IF I insert <br> tags, then they show up as text break tags. If I try something like \n then it also shows up as text. Now if I go into SugarCRM and edit a record, I can type in text and make a linebreak. Save the record and view it again and the line breaks show up as I would want them to! I am trying to save data with line breaks to the same field from a remote API script. I went into the Database with

h:selectOneRadio renders all select items in one line, how to render each in new line?

試著忘記壹切 提交于 2019-12-20 02:23:50
问题 I have a selectOneRadio tag and all radio button options are displayed on one row. How can I make it one option per row/line? 回答1: To learn about tag's behavior and all of its available attributes, a good starting point is the tag documentation. Here's an extract relevance from the <h:selectOneRadio> tag documentation: [...] Encode Behavior Render a "table" element. If the "styleClass" is specified, render the value of the "styleClass" attribute as the value of the "class" attribute on the

h:selectOneRadio renders all select items in one line, how to render each in new line?

こ雲淡風輕ζ 提交于 2019-12-20 02:23:27
问题 I have a selectOneRadio tag and all radio button options are displayed on one row. How can I make it one option per row/line? 回答1: To learn about tag's behavior and all of its available attributes, a good starting point is the tag documentation. Here's an extract relevance from the <h:selectOneRadio> tag documentation: [...] Encode Behavior Render a "table" element. If the "styleClass" is specified, render the value of the "styleClass" attribute as the value of the "class" attribute on the

Handling new lines in php

删除回忆录丶 提交于 2019-12-20 02:15:48
问题 I have form in html where user can put the text in text area. I save the content of text area into MySQL database (in field of type TEXT). Then I somewhere in my aplication I need load that text and put it into array where in each index will be one line of the text. <textarea rows="10" cols="80"> Row one Row two Row tree </textarea> array (output in "php pseudocode"): $array = array(); $array[0] = Row one; $array[1] = Row two; $array[2] = Row tree; How I do it: I save it to db then I load it

Reduce paragraph line break height on iTextSharp

霸气de小男生 提交于 2019-12-20 01:39:10
问题 How can I reduce the height of a line break which occurs when a paragraph length is too long for the width of the ColumnText? I've tried the following, as I've seen other questions which answered with this: p.Leading = 0 But this has made no affect. I've also tried increasing the Leading to 100 to see if a larger line break is added, but neither work. SpacingBefore/SpacingAfter doesn't help either: p.SpacingBefore = 0 p.SpacingAfter = 0 How can I reduce this? 回答1: When using a table, you need

PHP REGEX - text to array by preg_split at line break

寵の児 提交于 2019-12-19 09:28:03
问题 EDITED: need help on split Array array example: array ( [0] => :some normal text :some long text here, and so on... sometimes i'm breaking down and... :some normal text :some normal text ) ok, now by using preg_split( '#\n(?!s)#' , $text ); i get [0] => Array ( [0] => some normal text [1] => some long text here, and so on... sometimes [2] => some normal text [3] => some normal text ) I want get this: [0] => Array ( [0] => some normal text [1] => some long text here, and so on... sometimes i'm

file_put_contents, file_append and line breaks

不打扰是莪最后的温柔 提交于 2019-12-18 18:48:31
问题 I'm writing a PHP script that adds numbers into a text file. I want to have one number on every line, like this: 1 5 8 12 If I use file_put_contents($filename, $commentnumber, FILE_APPEND) , the result looks like: 15812 If I add a line break like file_put_contents($filename, $commentnumber . "\n", FILE_APPEND) , spaces are added after each number and one empty line at the end (underscore represents spaces): 1_ 5_ 8_ 12_ _ _ How do I get that function to add the numbers the way I want, without