Webmaster in a Nutshell

Previous Chapter 15 Next
 

15.11 String Functions

chomp list(dagger)

Removes line endings from all elements of the list; returns the (total) number of characters removed.

chop list(dagger)

Chops off the last character on all elements of the list; returns the last chopped character.

crypt plaintext, salt

Encrypts a string.

eval expr(dagger)

expr is parsed and executed as if it were a Perl program. The value returned is the value of the last expression evaluated. If there is a syntax error or runtime error, an undefined string is returned by eval, and $@ is set to the error message. See also eval in the section called "Miscellaneous".

index str, substr [ , offset ]

Returns the position of substr in str at or after offset. If the substring is not found, returns -1 (but see $[ in the section called "Special Variables").

length expr(dagger)

Returns the length in characters of the value of expr.

lc expr

Returns a lowercase version of expr.

lcfirst expr

Returns expr with the first character lowercase.

quotemeta expr

Returns expr with all regular expression metacharacters quoted.

rindex str, substr [ , offset ]

Returns the position of the last substr in str at or before offset.

substr expr, offset [ , len ]

Extracts a substring of length len out of expr and returns it. If offset is negative, counts from end of the string. May have a value assigned to it.

uc expr

Returns an uppercased version of expr.

ucfirst expr

Returns expr with the first character uppercased.


Previous Home Next
Structure Conversion Book Index Array and List Functions