Perl deletes leading and trailing Spaces
This article mainly introduces Perl to delete leading and trailing spaces (remove left and right spaces and blank characters). This article provides multiple methods to solve this problem. For more
In other programming languages, Functions LTrim and RTrim are used to remove spaces and tabs from the beginning and end of a string, respectively. Some also provide the function trim to remove whitespace characters at both ends of the string. Perl
This article mainly introduces Perl delete leading and trailing blanks (remove left and right spaces, white space characters), this article gives a number of methods to achieve this requirement, the need for friends can refer to the following
In
Use a subroutine to remove the spaces at the beginning and end of each line read from the file. The print Value of the sub function is no longer blank, but the returned value is printed with spaces. The Code is as follows:
While ()
{
& Trim ($
Many languages have specialized functions or methods to delete spaces at the beginning and end of a string, such as chomp of Perl and strip of Python. Then JavaScript does not seem to have similar functions, which are not mentioned in some manuals.
Special characters in regular expressions
Character implication
\ As a turn, that is, the characters usually after "\" are not interpreted in the original sense, such as the/b/matching character "B", when B is preceded by a backslash/\b/, to
Dependencies
First of all, need a version of Qt for Windows. If You is an open source developer so you can download the Open source Edition of Qt for Windows from the Nokia Website : Http://qt.nokia.com/downloads; Version for Windows32 bit is
String typeIn Python, string types can be used in pairs of single quotes, such as: ' Hello, China. can also be used in pairs of double quotes, such as: "Bad, I drop country." The code is as follows: Through. Title (), you can turn the first
First, Let's take a look at two special characters: ' ^ ' and ' $ ' they are used to match the start and end of the string, respectively, to illustrate
"^the": matches a string that starts with "the";"Of despair$": matches a string ending with "of
To generate a file name for a graphics file in the R language, the prefix is Fitbit, followed by the month after, plus ". jpg", first not Baidu, tried other languages similar grammar, not a viable:In C #: "Fitbit" + month + ". jpg"VB: "Fitbit" &
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.