On Saturday 11 January 2003 08:51 pm, [EMAIL PROTECTED] wrote: > who knowes how to count the charcaters in a string without the space > character?
you need to be more clear. number of characters in the string except space? number of distinct characters in the string except space? include other non-space whitespace (\t \n \r etc)? case sensitive? this is really not hard at all and would be educational for you to write yourself, as an exercise in learning php. one approach: 1. create an empty string, charsfound. for each character in your input string, see if the character already exists in charsfound (use strchr or strpos). if it's a space, continue the loop (don't exec the code below). if it's already there, skip to the next character. if it's not yet there, increment a counter, add the character to charsfound and continue the loop. at the end of the input string exit the loop. the counter is the number of distinct non-space characters in the input string. putting the "increment a counter" elsewhere (but in the appropriate places) in the loop will give you the number of non-space (not distinct) characters in the input string. tiger -- Gerald Timothy Quimpo tiger*quimpo*org gquimpo*sni-inc.com tiger*sni*ph Public Key: "gpg --keyserver pgp.mit.edu --recv-keys 672F4C78" Veritas liberabit vos. Doveryai no proveryai. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php