You are here: Re: ASP2PHP Function List Reference « PHP Programming Language « IT news, forums, messages
Re: ASP2PHP Function List Reference

Posted by Jim Michaels on 02/07/06 11:11

"T.Taylor" <taylort2@juno.com> wrote in message
news:1138215417.551296.214220@g47g2000cwa.googlegroups.com...
> The stop parameter is the last character's position not the length.
>
> Example:
> =======
> str="hello"
> Mid(str,2,4) would equal "ell"
>
> InStr is function that returns the start position in a string where it
> found the value otherwise is returns 0
>
> Example:
> ========
> str="hello"
> value1="he"
> value2 ="ll"
> value3="low"
>
> InStr(str,value1) would return 1 as the position it found the value
> string starting location
> InStr(str,value2) would return 3; the starting position of the value in
> the string
> InStr(str,value3) would return 0; because it couldn't find the value in
> the string
>

in that case, InStr sounds like
int strpos ( string haystack, mixed needle [, int offset] )
int stripos ( string haystack, string needle [, int offset] )
int strripos ( string haystack, string needle [, int offset] )
int strrpos ( string haystack, string needle [, int offset] )
where offset is optional. strpos is a forward-direction search,
case-sensitive.
the i in the function name means a case-insensitive search. the r in the
function name means a reverse-direction search from the end of the string.
strpos returns the numeric position of the first occurrence of needle in the
haystack string. Unlike the strrpos(), this function can take a full string
as the needle parameter and the entire string will be used.

If needle is not found, strpos() will return boolean FALSE.

PHP gets its string functions from the standard C library plus a bunch more.
you will find them fairly powerful. there is even a tokenizer strtok() and
something that returns the MD5 hash of a string md5().

look up printf(). you can format a string or number almost any way you like
with it. and numbers don't get leading spaces in them like vb puts in.

strtr() does a character translation.

soundex() calculates the soundex key of a string for sounds-like searches.

if you know how to use regular expressions, they are very powerful for doing
complicated search-and-replace work on text. see preg_replace() and
preg_match()

see http://www.php.net/manual/en/ref.strings.php for a starter.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация