Adamli2000
08-25-2003, 10:30 PM
Thanks a lot
|
Click to See Complete Forum and Search --> : What does "/r" "/n" mean ???:( Adamli2000 08-25-2003, 10:30 PM Thanks a lot pyro 08-25-2003, 10:46 PM I'm assuming you mean \r and \n. If so, they are the codes to add a line break. Adamli2000 08-25-2003, 10:48 PM You mean both of them? thanks pyro 08-25-2003, 10:53 PM Well, they are a bit different. For example, in PHP, when working with files, \n is the *nix line break, while \r\n is the Windows line break... (Windows likes to be special...) For the most part, \n is what you need. In JavaScript, \n is a line break in an alert, etc... Adamli2000 08-25-2003, 10:59 PM We are using JavaScript to make a Rich Text Format component. In the RTF,after editing the data, it will be stored in a database,and take it out to show when necessary. well, there is a function to transfer the format of the data before entering the database and after coming out the database. It is like this String toHTML(String value) { if ( value == null ) return ""; value = replace(value, "\r\n","<BR> "); value = replace(value, "\r","<BR> "); value = replace(value, "\n","<BR> "); return value; } String toHTMLother(String value) { if ( value == null ) return ""; value = replace(value,"<BR> ", "\r\n"); value = replace(value, "<BR> ","\r"); value = replace(value,"<BR> ", "\n"); return value; } My question is why they use such a transfer function instead of putting the data directly into the database? And how can "<BR> " take the place of "/r" pyro 08-25-2003, 11:03 PM in HTML, <br> is the line break. Also, they probably put it in the database using the \n or \r line ending as it is more readable while in the DB that way. webdeveloper.com
Copyright Internet.com Inc., All Rights Reserved. |