MathGroup Archive 2009

[Date Index] [Thread Index] [Author Index]

Search the Archive

Number of Words in a String


Hello everyone,

Is this the simplest way to find the number of words in a string?   
Seems a little complicated, and I can't seem to turn it into a  
function because when I replace the string with the argument  
placeholder myString_ I get an error message saying that a string is  
expected in that spot.

	Length[ReadList[StringToStream["The cat in the hat."], Word]]

	Returns 5.

Gregory


  • Prev by Date: Re: Re: Re: error with Sum and Infinity
  • Next by Date: Re: help import latex file with mathematica 7
  • Previous by thread: Re: video on Presentations by Williams
  • Next by thread: Re: Number of Words in a String