[mm_wordcount]

Description

Link: [mm_wordcount]
Author: Miles
Category: String
Version: 8.x
License:
Posted: May. 05, 2006
Updated: Jun. 30, 2006
More by this author...
This tag, courtesy of a lil help from the lasso community, computes the number of words in a given string.

Parameters

-string string, required must enter some text for it to operate!

Sample Usage

[mm_wordcount: -string='The Quickbrown Fox...']

or

[mm_wordcount: -string=(field:'somefieldvalue')]
						

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.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<?LassoScript
	
	define_tag:'mm_wordcount',
    -description='Returns the number of words in a string.',
    -required='string';

	local: 'v_text' = (#string);

	#v_Text ->(replace: ' - ', '') &
			(replace: ' , ', '') &
			(replace: ' & ', '') &
			(replace: ' ? ', '') &
			(replace: ' % ', '') &
			(replace: ' $ ', '') &
			(replace: ' # ', '') &
			(replace: ' @ ', '') &
			(replace: ' * ', '') &
			(replace: ' ! ', '') &
			(replace: ' > ', '') &
			(replace: ' < ', '') &
			(replace: ' / ', '') &
			(replace: ' \\ ', '') &
			(replace: ' { ', '') &
			(replace: ' } ', '') &
			(replace: ' [ ', '') &
			(replace: ' ] ', '') &
			(replace: ' | ', '') &
			(replace: ' = ', '') &
			(replace: ' + ', '') &
			(replace: ' ( ', '') &
			(replace: ' ) ', '') &
			(replace: ' _ ', '') &
			(replace: ' . ', '') &
			(replace: ' ...', '');
	
	return: (string_findregexp: #v_text, -find='(?:\\w+)')->size;
	
	/define_tag;
		
?>

 

Comments

none

Email:


Password:



Newest

Most Popular