getFindCount: Difference between revisions

From RPTools Wiki
Jump to navigation Jump to search
No edit summary
Line 1: Line 1:
==Function getFindCount==
{{MacroFunction
|name=getFindCount
|description=Returns the number of times that [[strfind| strfind()]] was able to match the input string.


Returns the number of times that [[Macros:Functions:strfind| strfind()]] was able to match the input string.
|usage=
 
===Usage===
<source lang="mtmacro" line>
<source lang="mtmacro" line>
[h: count = getFindCount(id)]
[h: count = getFindCount(id)]
Line 10: Line 10:
The id is the id value returned by [[Macros:Functions:strfind| strfind()]].
The id is the id value returned by [[Macros:Functions:strfind| strfind()]].


===Example===
|example=
<source lang="mtmacro" line>
<source lang="mtmacro" line>
[h: id = strfind("this is a test", "(\\S+)\\s+(\\S+)\\s*")]
[h: id = strfind("this is a test", "(\\S+)\\s+(\\S+)\\s*")]
Line 16: Line 16:
</source>
</source>
Returns 2.
Returns 2.
}}
[[Category:String Function]]

Revision as of 03:04, 7 March 2009

getFindCount() Function

Returns the number of times that strfind() was able to match the input string.

Usage

[h: count = getFindCount(id)]

The id is the id value returned by strfind().

Example

[h: id = strfind("this is a test", "(\\S+)\\s+(\\S+)\\s*")]
[r: getFindCount(id)]
Returns 2.