for the user's operating system, n* @access Public* @return String*/function Get_crlf (){if (Stristr ($_server[' http_user_agent '], ' Win ')){$the _crlf = ' RN ';}ElseIf (Stristr ($_server[' http_user_agent '), ' Mac '){$the _crlf = ' R '; For Old MAC OS}Else{$the _crlf = ' n '; the right to a significant point www.111cn.net}return $the _crlf;}
Note: When the front page is displayed, use the NL2BR to change the line into
Third, replace carriage return
code is as follow
1. Put ex. The message is replaced with an arbitrary string, which verifies that the dialog box can be displayed in the Catch statement block using the Response.Write method. The results show success, stating that the problem is in ex. The message.2. In the program below the breakpoint, you can see ex. The contents of the message are as follows:Focus is the red circle up the part, there is a carriage return + line symbol, it is estimated that he made the ghost, apart, directly remove it, the cod
On the positive I was a smattering, I am the idea of the regular is, can be used on the line!
For all the characters, my first understanding was. *
Then Google a bit, just know. * Connecting together means any number of characters that do not contain a newline.
So you can use [\s\s]* it means any whitespace character and non-white-space character. Similarly, you can use [\d\d]*], [\w\w]*] to express. D and D,w and W,s and S are all antisense and ad
To use a regular expression to get any character in a paragraph of text, write the following matching rule:
(.*)
After the results are run, the text after the wrapping cannot be obtained. Then I looked up the manual and found the regular expression, "." (dot notation) matches all characters except the newline character "\ n".
The following are the correct regular expression matching rules:
([\s\s]*)
It can also be represented by "([\d\d]*)", "([\w\w
Q-net > Article Tutorials > Programming design > PHP Delete a string of spaces and newline characters ultimate Method string newline character file encoding Web page encoding hidden characters
the ultimate method of removing spaces and line breaks in a string in PHPAsk the net 2015-04-03 23:38:42 1640 Browse
Article CatalogWhat is a space. What is a newline. HTML
Reprint Link: http://blog.csdn.net/tskyfree/article/details/8121951First, the concept:line feed ' \ n ' and carriage return ' \ R '(1) NewLine character is another line---'\ n' 10 newline (newline)(2) The carriage return is back to the beginning of the line---'\ r' 13 return car (return)So we usually write the file carriage return should be exactly called carriag
[Original]:http://mydebian.blogdns.org/?p=144
How to remove spaces or newline characters from a string.
So, let me-explain-in-Bash a set of words separated by one or more spaces characters is a very common thing Cause it is very easy to split and work with it. Thus, there are very little cases where you could need to remove all the spaces characters.
However, here are a little and simple example the how could your doing that:
$ echo "A b c D" | Sed '
Converts a newline character to
。
Syntax: String nl2br (String string);
return value: String
Function type: Data processing
Content Description
This function converts a newline character to an HTML line-wrapping
Instructions.
Copy the Code code as follows:
$STR = ' first lineSecond lineThe third line ';echo $str;//No replacementEcho ("-----------------");echo nl2br ($STR);//Display after replacement?>
CStdioFile file;
if (!file. Open (_t ("D:\\file.txt"), Cfile::modereadwrite)
{
File. Open (_t ("D:\\file.txt"), cfile::modecreate| Cfile::modereadwrite);
}
CString str;
CTime Time=ctime::getcurrenttime ();
Str. Format (_t ("%d-%-d-%-d%d:%-d:%-d Record:"), time. GetYear (), time. GetMonth (), time. Getday (), time. Gethour (), time. Getminute (), time. Getsecond ());
The STR string ends with a str.getlenth, which means the last byte is not displayed but exists, and the last one is not.
WORD Num=w
Here are a few ways to help you solve this problem.
The PHP version adds the HTMLLine breaks convert to newline characters in text boxes:
Copy the Code code as follows:function Br2nl ($text) {return Preg_replace ('//I
', ', $text);
}
Or:
Copy the Code code as follows:function Br2nl ($text) {$text =preg_replace ('/I/I
', Chr (), $text);
return Preg_replace ('//I ', ', $text);
}
JS version will be in the HTMLLine
1. IntroductionIn JavaScript, when you define a large string, especially if there is a line break, in order to look neat and readable, you generally use a continuation character, for example:var script = "var chart = Anychart.piechart ([[' Chocolate Paste ', 5], [' White Honey ', 2], [' Strawberry jam ', 2 ], [' сondensed milk ', 1] ]);//chart.bounds (0, 0, 100%,100%); var stage = anychart.graphics.create (' container ', (a);
thinkphp volist Tag mod controls certain recorded newline bug resolution, Thinkphpvolist
In this paper, we describe the method of thinkphp the volist tag mod to control a certain record of a newline bug. Share to everyone for your reference. Here's how:
First, the description of the bug:
exists in thinkphp version 2.0
MoD properties are also used to control the line breaks for a certain record, for example
When there is too much code in your code, it is especially inconvenient to read the code, and you need to use a newline character "\". Be aware of two points when using line breaks:
The 1.c compiler is based on ";" To determine if it is a statement, so as long as it's not wrapped in parentheses, it's OK.
2. Do not put the space in the middle.
line wrap problem when string constants are definedIf we place a backslash at the end of a line of code, the
When using FTP software upload to download PHP source files, we occasionally found in the local Windows notepad++ editor written php files, after using FTP uploaded to the linux server, the PHP file line break all lost, resulting in PHP file does not work properly.This time, again through the FTP software to download the php file just uploaded to the local windows, opened with the notepad++ editor, found that the PHP source code into a line, lost line.What is the reason for this situation? Float
resolve problems with textarea input in the JSP (including carriage return, newline, space)
Package com.work.util;
/**
* Solve the problem of textarea input display in JSP (including carriage return, newline, space)/public
class Textareademo {public
static void main (String [] args {
String str = "AAA \ r \ n bbbb bbb";
SYSTEM.OUT.PRINTLN (Textareademo.turn (str));
/**
* The following code d
. NewLine characters in replace field, carriage return 1: Carriage return character SELECT *, replace (detail, CHAR (+), ' 2: Line break SELECT *, replace (detail, CHAR (Ten), ' 3: Return line break SELECT *, replace (detail, char (+) + char (Ten), ' 4: Replace carriage return line break to UPDATE loginfo SET detail = REPLACE (detail, char) + char (Ten), ' Note In the DOS \win series there will be a carriage return +
$.get (' ajax.php tutorial ', {
ID: $ (' #test '). attr (' value ');
}, function (data) {
if (data = = 1) {
$ (' #test_div '). Remove ();
Alert (' Delete succeeded! ');
} else {
Alert (' delete failed, please try again! ');
}
});
This is a data that was implemented in jquery and sent using the Get method, sending a value of test ID to the ajax.php page, as Ajax.php wrote:
if (Isset ($_get[' id ')) {
$result = MySQL Tutoria
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.