|
[Date Index]
[Thread Index]
[Author Index]
Re: Number of Words in a String
- To: mathgroup at smc.vnet.net
- Subject: [mg102532] Re: [mg102483] Number of Words in a String
- From: jaebum at wolfram.com
- Date: Wed, 12 Aug 2009 04:36:36 -0400 (EDT)
- References: <200908110802.EAA21929@smc.vnet.net>
> 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
>
>
This might be simpler:
In[24]:= Length[StringSplit["The cat in the hat."]]
Out[24]= 5
- Jaebum
Prev by Date:
Re: Number of Words in a String
Next by Date:
Re: Number of Words in a String
Previous by thread:
Re: Number of Words in a String
Next by thread:
Re: Number of Words in a String
|