Perl String FunctionschompRemoves line ending characters from a string or array of strings. chopRemoves the last character from a string or array of strings. chop STRING evalEvaluates perl code, then executes it. eval STRING Any errors are returned in the @a variable. indexThis function returns the position of the first occurance of the specified SEARCH string. If POSITION is specified, the occurance at or after the position is returned. The value -1 is returned if the SEARCH string is not found. rindex STRING,SEARCH,POSITION rindex STRING,SEARCH lengthReturns the length of the string in bytes. length STRING lcConverts all characters in the string to lower case. lc Str | <script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript"> </script> |
lcfirst
Takes a string and retruns it with the first character in lower case.
lcfirst Str1
quotemeta
rindex
This function returns the position of the last occurance of the specified SEARCH string. If POSITION is specified, the occurance at or before the position is returned. The value -1 is returned if the SEARCH string is not found.
rindex STRING,SEARCH,POSITION rindex STRING,SEARCH
substr
This function supports three sets of passed values as follows:
substr (STRING,OFFSET,LEN,REPLACEMENT) substr (STRING,OFFSET,LEN) substr (STRING,OFFSET)
The function:
substr (STRING,OFFSET)
returns all characters in the string after the designated offset from the start of the passed string. The function:
substr (STRING,OFFSET,LEN)
returns all characters in the string after the designated offset from the start of the passed string up to the number of characters designated by LEN. The function:
substr (STRING,OFFSET,LEN,REPLACEMENT)
Replaces the part of the string beginning at OFFSET of the length LEN with the REPLACEMENT string.
uc
Converts all characters in the string to upper case.
uc Str
ucfirst
Takes a string and retruns it with the first character in upper case.
ucfirst Str1

博客介绍了Perl中多个字符串处理函数。如lcfirst将字符串首字符转小写,uc将所有字符转大写,ucfirst将首字符转大写;rindex返回指定搜索字符串最后出现的位置;substr可截取或替换字符串指定部分。


被折叠的 条评论
为什么被折叠?



