Lasso Soft Inc. > Home

[lp_string_wordcount]

Linklp_string_wordcount
AuthorBil Corry
CategoryString
Version8.x
LicensePublic Domain
Posted08 May 2006
Updated08 May 2006
More by this author...

Description

Returns the number of words in a given string of text.

Requires [lp_string_extendedtoplain]

Sample Usage

var:'text' = "This is a test in the U.S.A. at 3:00pm with US$1,125.34 (EU$1.125,34).
  It's great fun at O'Hare.  Hale-Bopp was an interest-
ing comet.
héllo wörld!?!?";
'
Text = ' $text '
'; lp_string_wordcount: $text; // returns 24

Source Code

Click the "Download" button below to retrieve a copy of this tag, including the complete documentation and sample usage shown on this page. Place the downloaded ".inc" file in your LassoStartup folder, restart Lasso, and you can begin using this tag immediately.

[

define_tag:'lp_string_wordcount',
	-description='Returns the number of words in a given string of text.',
	-priority='replace',
	-required='string';

	// ideas from this thread:
	// http://www.listsearch.com/lassotalk.lasso?id=163162

	return:	(string_findregexp: (lp_string_extendedtoplain: (string: $text)), -find='\\w+\\-\\s+\\w+|[\\w\\-\':,\\.\\$]*\\w+[\\w\\-\':,\\.\\$]*')->size;

/define_tag;

]

Comments

No comments

Please log in to comment

Subscribe to the LassoTalk mail list

LassoSoft Inc. > Home

 

 

©LassoSoft Inc 2015 | Web Development by Treefrog Inc | PrivacyLegal terms and Shipping | Contact LassoSoft