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
First of all, \n,\r,\t.
\ n Soft return:
Show line breaks in Windows and go back to the beginning of the next line
In Linux, Unix only represents line breaks, but does not go back to the beginning of the next line.
\ r Soft Space:
In Linux, Unix
Echoecho [OPTIONS] [string]-print STRING plus a line break-N Do not print end of line break-E After the string is escaped and printed-E does not escape string for direct printingFindFind [-h| l| P] [starting-point] [expression]The default
I. Text formatting differences with UltraEdit when you open a Unix text file, you are always prompted whether to convert the file to a DOS format. When you edit a profile in Windows and then upload it to a Linux host with FTP, you find that the
In the Unix world to line up with/n instead, but windows in order to reflect his differences, the use of/r/n, more interesting is the Mac with/R. So the UNIX series with the/n,windows series with the/r/n,mac with/R, so that you write the program on
The first type of notation:$content =str_replace ("\ n", "", $content);
Echo $content;
The second way:Str_replace ("\ r \ n", "", $str);
The third type of notation:$content =preg_replace ("/\s/", "", $content);
Echo $content;
Report:
First of
Echo command instance
The echo command is a built-in shell command used to display the value of a variable or print a line of text.
The echo command plays an important role in building shell scripts.
Syntax:
# Echo [Options] [String]
The items in
One, the following example can remove extra whitespace
The code is as follows
$STR = "This line containstliberal RN with Whitespace.nn";The leading/trailing whitespaceRemove the start and end blank Www.111cn.net$str =
UNIX Environment Advanced Programming read Chapter Three, encountered many redirects and other shell commands. When I think about Linux, it seems necessary to go ahead. Have seen a "embedded Linux software and hardware development detailed" This
Article Title: SED single-line script Quick Reference (Unix stream editor ). Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems,
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.