You can also look at VFP help ... :-)
To replace two spaces by one space:
STRTRAN(text, " ", " ")
To replace all spaces by commas:
CHRTRAN(text, " ", ",")
To replace many spaces by one space:
DO WHILE LEN(text) <> LEN(STRTRAN(text, " ", " "))
text = STRTRAN(text, " ", " ")
ENDDO
You could also find useful functions GETWORDCOUNT() and GETWORDNUM() which are not listed in above link.