MANUAL OF class strings
******************
DEPRECATED
This manual is deprecated. There are comments in strings_class.php
that should help you.
*** *** *** *** ***
>> Thanks to "rip" <hide@address.com>! He helped
me with my english errors :-)
>> If you want help me to write a PHP class that
format strings like unix fmt and justify it, send-me
a email!
>> Some of my Portuguese sites:
> http://www.que.com.br/php - Cronicas do PHP
artigos escritos por mim sobre php que sao enviados
periodicamente por email alem do seu arquivo de dicas.
>> http://www.que.com.br/perl - Cronicas do PERL
versao para PERL do Cronicas do PHP
>> Thanks for downloading my class!
CLASS: strings
This class is an expansion to the original PHP string funcions.
All functions are made to use special characters (192-223 and
224-255 in ascii table).
ALIASES:
$class->strtoupper = $class->uppercase
$class->strtolower = $class->lowercase
FUNCTIONS:
All functions above knows how convert a special char to their
upper/lower case, like covert a to Á or È to è.
* uppercase - make a string uppercase
string $class->uppercase(string string);
use like strtoupper PHP function
* lowercase - make a string lowercase
string $class->lowercase(string string);
use like strtolower PHP function
* ucfirst - make a string's first character uppercase
string $class->ucfirst(string string);
use like ucfirst PHP function
* lcfirst - make a string's first character lowercase
string $class->lcfirst(string string);
use like ucfirst PHP function
* ucwords - uppercase the first character of each word in a string
string $class->ucwords(string string);
use like ucwords PHP function
* lcwords - lowercase the first character of each word in a string
string $class->lcwords(string string);
use like lcwords PHP function
* normal - converts each special character (áéíÁÈÒÖ) to their
normal character (aeiAEOO)
string $class->normal(string string);
Example:
<?PHP
print $strings->normal("faço áeéíàÒ");
# will output: faco aeeiaO
?>
* remove - remove a string from an other
string $class->remove(string string,string to remove);
Example:
<?PHP
$remove = "removing the carriege return \r and the line \n break";
$remove = $strings->remove($remove,"\r");
$remove = $strings->remove($remove,"\n");
# will output: removing the carriege return and the line break
?>
* chomp - remove the \r and the \n from a string
string $class->chomp(string string);
Example:
<?PHP
$remove = "removing the carriege return \r and the line \n break";
$strings->remove($remove);
# will output: removing the carriege return and the line break
?>
* php_quote - remove the PHP open strings
string $class->php_quote(string string,bool <?PHP,bool SCRIPT,bool <?,bool <%);
Remove <?PHP and/or <? and/or <SCRIPT LANGUAGE="PHP"> and/or <% from a
string. You can chose what remove. The default is remove <?PHP and SCRIPT
tags.
If <?PHP is FALSE will NOT remove <?PHP tags
If SCRIPT is FALSE will NOT remove <SCRIPT LANGUAGE="PHP"> tags
If <? is TRUE will remove <? tags
If <% is TRUE will remove <% tags
Note that this function doesn't remove the tags, it put's a comment there.
Example to remove ONLY SCRIPT and <% tags:
<?PHP
print $strings->php_quote('
<?PHP is cool <br>
<? is cool to
BUT:
<SCRIPT LAnGuAge="PhP"> isn't cool</SCRIPT>
AND
<% isn't cool too!
',0,1,0,1);
?>
* file_ext - return the extension of a filename
string $class->file_ext(string string);
Return only the extension of a filename.
Example:
<?PHP
print $strings->file_ext("lilo.conf");
# will output: conf
?>
* file_noext - return the filename without it's extension
string $class->file_noext(string string);
Return only the name of a filename without ".extension"
Example:
<?PHP
print $strings->file_noext("lilo.conf");
# will output: lilo
?>
* stripdouble - return a string without double //'s
string $class->stripdouble(string string);
This function is a utility to work with file paths. It removes
the double // but doesn't replace // with / in http:// and ftp://
Example:
<?PHP
print $strings->stripdouble("http://localhost?file=/home/me//dir///algo");
# will output: http://localhost?file=/home/me/dir/algo
?>
* bar_quote - quotes the / of a preg
string $class->bar_quote(string string);
This function will convert a / to \/ in a string. If you don't quote
a string and try to use:
preg_match("/my/he/","my/he and they",$parts);
You will got an error!
last modication 03/12/2000 20:13 by Roberto Berto (berto at que.com.br)