[thelist] converting whitespace to single space between printable characters

Matt Warden mwarden at gmail.com
Wed Dec 7 22:40:28 CST 2005


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Alex Beston wrote:
> Hi evolt
> 
> Im trying to reduce the whitespace between printable characters to a single space.
> 
> What i want to do is get all of the the words in a text so as to make a 
> histogram of word frequencies.
> 
> Im doing this by exploding the string and using space as the delimiter. 
> that only works in so far as words that are separated by spaces. so i 
> find that i get words that have been yoked together since they were 
> seperated with a return character.

While I hate the way PHP implements tokenizer, I think you will be
better off using it:

http://us2.php.net/strtok

- --
Matt Warden
Miami University
Oxford, OH, USA
http://mattwarden.com


This email proudly and graciously contributes to entropy.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFDl7k8rI3LObhzHRMRAoFuAKCenejhGZvqIFokIMhHeSHteTJekACeMTBF
4+6YCIL4wHUoPHtfNnGeMfQ=
=nzAJ
-----END PGP SIGNATURE-----



More information about the thelist mailing list