Asked  7 Months ago    Answers:  5   Viewed   25 times

I'd like to know the difference (with examples if possible) between CR LF (Windows), LF (Unix) and CR (Macintosh) line break types.

 Answers

37

It's really just about which bytes are stored in a file. CR is a bytecode for carriage return (from the days of typewriters) and LF similarly, for line feed. It just refers to the bytes that are placed as end-of-line markers.

Way more information, as always, on wikipedia.

Tuesday, June 1, 2021
 
twk
answered 7 Months ago
twk
26

First, replace line breaks with <br />:

$post = nl2br($post_data['content']);

Then replace double <br /> with closing and opening paragraph tag (the original line break is maintained by nl2br, so I use a regular expression, that matches all styles of line breaks):

$post = '<p>' . preg_replace('#(<br />[rn]+){2}#', '</p><p>', $post) . '</p>';

Note that this is XHTML syntax, if you want to have HTML, change the code as follows:

$post = nl2br($post_data['content'], false);
$post = '<p>' . preg_replace('#(<br>[rn]+){2}#', '</p><p>', $post) . '</p>';

Test:

$post_data['content'] = <<<TXT
line 1 paragraph 1,
line 2 paragraph 1.

line 3 paragraph 2,
line 4 paragraph 2,
line 5 paragraph 2.
TXT;

$post = nl2br($post_data['content'], false);
$post = '<p>' . preg_replace('#(<br>[rn]+){2}#', "</p>nn<p>", $post) . '</p>';

echo $post;

Test Output:

<p>line 1 paragraph 1,<br>
line 2 paragraph 1.</p>

<p>line 3 paragraph 2,<br>
line 4 paragraph 2,<br>
line 5 paragraph 2.</p>
Saturday, May 29, 2021
 
Manmay
answered 7 Months ago
44

JavaScript has the notion of primitive types (number, string, etc) and object types (Number, String, etc, which are manifest at runtime). TypeScript types number and Number refer to them, respectively. JavaScript will usually coerce an object type to its primitive equivalent, or vice versa:

var x = new Number(34);
> undefined
x
> Number {}
x + 1
> 35

The TypeScript type system rules deal with this (spec section 3.7) like this:

For purposes of determining subtype, supertype, and assignment compatibility relationships, the Number, Boolean, and String primitive types are treated as object types with the same properties as the ‘Number’, ‘Boolean’, and ‘String’ interfaces respectively.

Thursday, June 3, 2021
 
Fanda
answered 6 Months ago
23

All the support libraries are dropping the v4 v7 v12 v13 etc tags and everything is refactored into the androidx packages.

They are essentially the same but for future reference androidx will be the library that we should use in our apps.

Android studio 3.2 canary that comes out this week (week of May 14, 2018) should have the tool that allows automatic refactoring to the androidx packages. There was an announcement about this at google i/o 2018.

Sunday, July 18, 2021
 
Amber
answered 5 Months ago
10

I think the only actually good solution is to switch divs with list

<ul style="width:100px">
    <li style="width:50%; display: inline-block;">
        div1
    </li>
    <li style="width:50%; display: inline-block;">
        div2
    </li>
</ul>

typically 'reseting' the list properties will make it look like a div. The benefit is that browsers will not generate space between <li> items.

Saturday, October 30, 2021
 
David Arno
answered 1 Month ago
Only authorized users can answer the question. Please sign in first, or register a free account.
Not the answer you're looking for? Browse other questions tagged :  
Share