Page 1 of 1

Manipulating a string??

Posted: Thu Feb 22, 2007 11:58 am
by wlbasile
I am trying to take a string and firstly:

Spit it back out with no characters other than letters and numbers, and with the first letter of every word capitalized.

Secondly:

Do the same thing as above, but remove all spaces from the string.

I've been advised to use the following functions:

strlen() (Accompanied by a for loop to go through every character)
strpos()
substr()

I am unsure how to set this up. Can anyone help?

Posted: Thu Feb 22, 2007 12:04 pm
by Kieran Huggins
maybe a regex is the way to go? but they can be somewhat tricky.

http://ca3.php.net/manual/en/function.preg-replace.php