startsWith: Difference between revisions

From RPTools Wiki
Jump to navigation Jump to search
(New page: ==Function startsWith== '''Introduced in MapTool 1.3b49''' Returns 1 if the string starts with a certain sub string. ===Usage=== <source lang="mtmacro" line> [h: result = startsWith(st...)
 
No edit summary
 
(13 intermediate revisions by 8 users not shown)
Line 1: Line 1:
==Function startsWith==
{{MacroFunction
|name=startsWith
|version=1.3b49
|description=
Returns {{true}} if the first parameter starts with the contents of the second parameter.


|usage=
<syntaxhighlight lang="mtmacro" line>
[h: result = startsWith(string, substring)]
</syntaxhighlight>


'''Introduced in MapTool 1.3b49'''
Returns {{true}} if the string starts with a certain substring and {{false}} if not.


Returns 1 if the string starts with a certain sub string.
|examples=
<syntaxhighlight lang="mtmacro" line>
[r: startsWith("Test", "T")]
[r: startsWith("Test", "Te")]
[r: startsWith("Test", "Tez")]
</syntaxhighlight>


===Usage===
'''Returns'''
<source lang="mtmacro" line>
<pre> 1
[h: result = startsWith(str, substr)]
  1
</source>
  0</pre>
 
}}
 
[[Category:String Function]]
===Examples===
<source lang="mtmacro" line>
[r: endsWith("Test", "T")]
[r: endsWith("Test", "Te")]
[r: endsWith("Test", "Tez")]
</source>
 
Returns
    1
    1
    0

Latest revision as of 23:59, 14 March 2023

startsWith() Function

Introduced in version 1.3b49
Returns true(1) if the first parameter starts with the contents of the second parameter.

Usage

[h: result = startsWith(string, substring)]

Returns true(1) if the string starts with a certain substring and false(0) if not.

Examples

[r: startsWith("Test", "T")]
[r: startsWith("Test", "Te")]
[r: startsWith("Test", "Tez")]

Returns

  1
  1
  0