|
In JavaScript this was a cross-browser compatibility issue, so both were used, but there are numerous instances in different languages where I see both printed out together as \r\n. Is this still the generally excepted norm that you should just always...
Started by hal10001 on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
Protocol.
Many 'cross platform' languages abstract this in a platform dependant variable .
Wise: Unix uses \n as a carriage return, Windows uses \r\n and I think MacOS used (not sure about now) \r.
|
|
How can I replace lone instances of \n with \r\n (LF alone with CRLF) using a regular expression in C#?
Sorry if it's a stupid question, I'm new to Regex.
I know to do it by:
myStr.Replace("\n", "\r\n"); myStr.Replace("\r\r\n", "\r\n");
But this is inelegant...
Started by dbkk on
, 6 posts
by 6 people.
Answer Snippets (Read the full thread at stackoverflow):
If you want it to detect lines that start with just a single '\n' as well, then try
([^\r]|$)\n:
myStr....
Will this do?
[^\r]\n
Basically it matches a '\n' that is preceded with a character that is not '\r'.
|
|
Why eval function doesn't work with \r\n but with \n. for example eval("for i in range(5):\r\n print 'hello'") doesn't work eval("for i in range(5):\n print 'hello'") works
I know there is not a problem cause using replace("\r","") is corrected, but someone...
Started by juanefren on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
It would be better if you didn't ....
In general, it would be safer for you to use replace('\r\n', '\n') in case there's a meaningful '\r' in there somewhere.
n'), not the two-character sequence '\r\n'.
|
Ask your Facebook Friends
|
Simple question...
I have seen people tell me to use "\r\n" in various places and others tell me to use "\n" in the same place. I'm sure one is right and one is wrong. Example - when designing mail() headers:
Tutorial #1:
//define the headers we want ...
Started by johnnietheblack on
, 4 posts
by 4 people.
Answer Snippets (Read the full thread at stackoverflow):
\n is the end of line character for UNIX always be \r\n ( <CR><LF> ) in mail headers and content, but in practice it shouldn't matter-based ones actually....
r\n are end of line characters for Windows systems.
|
|
I have a form with a textarea and a JS character counter. Yet the backend script claims that the strlen of the message is longer than the JS character counter claimed. The reason for this, I have discovered, is that the backend sees every newline character...
Started by Mala on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
You may choose to expand it when extracting later.
Note that a \r in places other than just before a \n may hold other significance and so you shouldWhen storing it is acceptable to only use \n .
|
|
I'm trying to do the opposite of this question , replacing Unix line endings with Windows line endings, so that I can use SQL Server bcp over samba to import the file . I have sed installed but not dos2unix . I tried reversing the examples but to no avail...
Started by jmgant on
, 6 posts
by 6 people.
Answer Snippets (Read the full thread at stackoverflow):
-type f -name '*') do cat $file | sed 's/\n/\r\n/g' > $file.new mv -f $file.new $file done
You to be platform....
Maybe if you try it this way
cat myfile | sed 's/\n/\r\n/g' > myfile.win
will work, from my .
|
|
I've been writing code for ASP.NET since the start, and today I encountered something I've never seen before. Typically I've looked for line breaks in C# (when posted in ASP.NET from a textarea, for example) by expecting "\r\n". Now I'm using the MVC ...
Started by Jeff Putz on
, 4 posts
by 4 people.
Answer Snippets (Read the full thread at stackoverflow):
Fore more background, check out the Newline = form["Text"];....
\r\n is Windows-specific line-ending behaviour to check not only for \r\n but also for \n alone.
n is the line ending variant on *nix-style systems.
|
|
Is there a built in method in a java library that can compute 'N choose R' for any N, R?
Started by Aly on
, 6 posts
by 6 people.
Answer Snippets (Read the full thread at stackoverflow):
No need to import an external library - from the definition of combination, with n cards that would be n*(n-1)/....
The mathematical formula for this is:
N!/((R!)(N-R)!)
Shouldn't be hard to figure it out sizes...
|
|
How do I replace the string "\r\n" with the same characters. Example:
Hello World.\r\nHello World.
replaced with:
Hello World. Hello World.
Started by C. Ross on
, 4 posts
by 4 people.
Answer Snippets (Read the full thread at superuser):
Type "\\r\\n" in "Find ....
Press CTRL-h and the Replace dialog will open.
In the find text box put "\\r\\n", and in the replace text box put "\r\n".
In the find screen, on the replace tab choose extended search .
|
|
Well gues it won again! Owell, hopefully next week they can put on a show form Mike. Think he was there tonight, didn't want them to run so sent word to the big man. RIP MIKE #71
Started by 32RacenT1 on
, 4 posts
by 4 people.
Answer Snippets (Read the full thread at ohiovalleydtr):
Brady Reed....
Just mini wedge feature....
|