linebreaks

Elegant solution for line-breaks (PHP)

$var = "Hi there"."<br/>"."Welcome to my website"."<br/>;" echo $var; Is there an elegant way to handle line-breaks in PHP? I'm not sure about other languages, but C++ has eol so something thats more readable and elegant to use? Thanks ...

Python line file iteration and strange characters

I have a huge gzipped text file which I need to read, line by line. I go with the following: for i, line in enumerate(codecs.getreader('utf-8')(gzip.open('file.gz'))): print i, line At some point late in the file, the python output diverges from the file. This is because lines are getting broken due to weird special characters tha...

How can I detect dos line breaks in a file?

I have a bunch of files. Some are unix line endings, many are dos. I'd like to test each file to see if if is dos formatted, before I switch the line endings. How would I do this? Is there a flag I can test for? Something similar? ...

iPhone NSString drawAtPoint linebreakmodeWordWrap

Hello, Since I had a very slow scrolling tableView I'm now trying to catch up with the direct draw method, similiar to the Tweetie App sample or Apples TableViewSuite code. So right now I'm struggling to draw NSString with more than one line. I'm using the [NSString drawAtPoint: forWidth: withFont: linebreakMode:] method, and it "brea...

Firefox adds <br> when paste from Word in TinyMCE

I'm currently using TinyMCE 3.3 on a drupal site, with an annoying problem. Using both "paste from word"-button or "Force cleanup on paste" in Firefox cause TinyMCE to insert line-breaks in my paragraphs where the line would have ended in Word. In IE, I do not have this problem. When viewing the source code in the editor, it doesn't ...

jQuery convert line breaks to br (nl2br equivalent)

I'm having jQuery take some textarea content and insert it into an li. I want it to visually retain the line breaks. There must be a really simple way to do this... ...

JSP Document/JSPX: what determines how tabs/space/linebreaks are removed in the output?

I've got a "JSP Document" ("JSP in XML") nicely formatted and when the webpage is generated and sent to the user, some linebreaks are removed. Now the really weird part: apparently the "main" .jsp always gets all its linebreak removed but for any subsequent .jsp included from the main .jsp, linebreaks seems to be randomly removed (some ...

Regex and PHP for extracting contents between tags with several line breaks

How can I extract the content between tags with several line breaks? I'm a newbie to regex, who would like to know how to handle unknown numbers of line break to match my query. Task: Extract content between <div class="test"> and the first closing </div> tag. Original source: <div class="test">optional text<br/> content<br/> <br/> c...

How to read line by line a CR-only file with Perl?

I'm trying to read a file which has only CR as line delimiter. I'm using Mac OS X and Perl v.5.8.8. This script should run on every platform, for every kind of line delimiter (CR, LF, CRLF). My current code is the following : open(FILE, "test.txt"); while($record = <FILE>){ print $record; } close(TEST); This currently print onl...

Printing large integers to file in GAP without linebreaks

In GAP (http://www.gap-system.org/), I want to print large numbers to files without line breaks (to match the format for the b-files at Sloane's encyclopedia, for example: b000186.txt). However, if I use AppendTo("<filename>",n," ",f(n),"\n"); when f(n) is a large number, it adds linebreaks, which I don't want. Is there an easy way to ...

Displaying line breaks in XML using ASP.NET with XSLT

Hello all, I have a problem with my XML that I am trying to display on my ASP.NET page that I could do with some help with. What I would like to do is display it on a multi-line so I have an XML file that looks like this: <?xml version="1.0"?> <?xml-stylesheet type="text/xsl" href="News.xslt" ?> <newslist> <news> <date>20th June ...

How to ignore PHP break lines with POEdit parser?

I am currently translating my PHP application using gettext with POEdit. Since I respect the print margin in my source code, I was used to writing strings like that: print $this->translate("A long string of text that needs to follow the print margin and since php outputs whitespaces for every break line I do my sites renders...

How do I get my textarea to preserve newlines when using jQuery and JSON?

I have an textarea for user to input comment and a button to submit using jQuery .post() and JSON. $('#submit').click(function () { var comment = {}; comment.Author = $("#author").val(); comment.Email = $("#email").val(); comment.WebSite = $("#url").val(); comment.Body = $("#comment").val(); // te...

I get weird characters when removing line breaks in my aspx files

I wrote a small .NET applications that removes all line breaks in aspx/html/css code to make it harder to read for people trying to steal my design. And surprisingly I get weird characters that appear out of nowhere such as Â, » and others. They all stay at the same places, but I have no clue why they appear. Do you have any ideas on ho...

How can you parse excel CSV data that contains linebreaks in the data?

I'm attempting to parse a set of CSV data using PHP, but having a major issue. One of the fields is a long description field, which itself contains linebreaks within the enclosures. My primary issue is writing a piece of code that can split the data line by line, but also recognize when linebreaks within the data should not be used. Th...

JSF2: How to display a linebreak with outputText

I need to render a line break using outputText so that I can utilize the rendered attributed. I tried <h:outputText value="<br/>" escape="false" /> but it generated exception The value of attribute "value" associated with an element type "null" must not contain the '<' character. ...

PHP nl2br() basic function help

Can somebody please help me with this mail script. I'm simply trying to send an html email and part of the message is from a user textarea, which puts in \r\n. I seem to be unable to use nl2br or any other similar function. The code below isn't what I'm using but still produces the error. The code: $to = '[email protected]'; $subj...

another question about line break in UILabel

Hi everyone, I'm struggling with line break in UILabel. I'm generating xml in vb.net and then parse it in iPhone application. xml contains text which initially contains html tags such as , so I can and need to replace these tags with something to add a linebreak in iphone How can I do it? I tried \n , \n\r, they a not working Any help ...

replacing linebreaks with <br> to use in UIWebView

I am pulling my data from sqlite and trying to show it in a UIWebView I have tried HTMLData = [container stringByReplacingOccurrencesOfString:@"\n" withString:@"<br />"]; HTMLData = [HTMLData stringByReplacingOccurrencesOfString:@"\r" withString:@"<br />"]; HTMLData = [HTMLData stringByReplacingOccurrencesOfString:@"\r\n" withSt...

Netlogo: line break in output file?? Not so simple.

Dear reader, I tried all options to create a new line in my output file, but still I get a txt-file with everything behind the previous information. Even with this supersimple code: globals [file] to setup clear-all set file "results\GA1.txt" if is-string? file [while [file-exists? file] [set file replace-item (lengt...