startsWith: Difference between revisions

From RPTools Wiki
Jump to navigation Jump to search
m (Conversion script moved page startsWith to StartsWith without leaving a redirect: Converting page title to first-letter uppercase)
No edit summary
 
(One intermediate revision by one other user not shown)
Line 6: Line 6:


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


Returns {{true}} if the string starts with a certain substring and {{false}} if not.
Returns {{true}} if the string starts with a certain substring and {{false}} if not.


|examples=
|examples=
<source lang="mtmacro" line>
<syntaxhighlight lang="mtmacro" line>
[r: startsWith("Test", "T")]
[r: startsWith("Test", "T")]
[r: startsWith("Test", "Te")]
[r: startsWith("Test", "Te")]
[r: startsWith("Test", "Tez")]
[r: startsWith("Test", "Tez")]
</source>
</syntaxhighlight>


'''Returns'''
'''Returns'''

Latest revision as of 17:39, 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