Perl-04-string functions

Source: Internet
Author: User
Tags uppercase letter

1. $ position = index (string, substring, skipchars );

This function returns the position of the substring in the string. If the substring does not exist,-1 is returned. The skipchars parameter is an optional parameter, indicating the number of characters that have been skipped. That is: search from this location;

2. rindex (string, substring, skipchars): The function is similar to index (). The difference is that it starts searching from the right of string;

3. $ Len = length (string): Evaluate the length of the string;

4. $ offset = pos (string): returns the position of the last pattern match;

5. $ substring = substr (string, skipchars, length): This function skips the position of skipchars in string (from the position of skipchars) start to extract the length of the Child string; the first character is 0;

6. Study (string): increases the access speed of variables in an internal format, and takes effect only for one variable at a time;

7. LC (string): converts all letters in string to lowercase letters;

8. UC (string): converts all letters in string to uppercase letters;

9. lcfirst (string): converts the first letter in string to a lower-case letter;

10. ucfirst (string): converts the first letter in the string to a uppercase letter;

11. Join (sepatorstring, list): concatenates all elements in the list to the same string, and separates two adjacent elements using sepatorstring;

12. sprintf (formatstring, field1, field2 ,..., fieldn): this function is used in the same way as the sprintf () function in C language. It is used to format multiple strings. The difference is that the function returns the formatted result string;

13. quotemeta (string): Add a backslash (/) to the front of a non-word in string "/";

14. HEX (string): converts hexadecimal data in the string format to a decimal integer;

15. INT (floatnum): removes the fractional part of the floating point and converts it to an integer;

16. OCT (ocunum): converts string-type octal (0) or hexadecimal (0x) data to a decimal number;

17. ord (char): returns the ASCII value (integer) of the character char );

18. CHR (ascii_value): returns the character corresponding to the integer ascii_value; 0 <= ascii_value <= 255;

19. defined (expr): determines whether an element in a variable, array, or array has been assigned a value. expr is a variable name, array name, or array element; if the value has been defined or assigned, true is returned; otherwise, false is returned;

20. UNDEF (expr): cancels the definition of elements in a variable, array, or array, or even cancels sub-ProgramAnd reclaim the occupied space. The returned value is always an undefined value. This value is equivalent to an empty string, for example, $ retvalue = UNDEF (expr );

Related Article

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.