EndsWith (String function): Difference between revisions

From m204wiki
Jump to navigation Jump to search
(Automatically generated page update)
 
No edit summary
 
Line 1: Line 1:
{{Template:String:EndsWith subtitle}}
{{Template:String:EndsWith subtitle}}
<var>EndsWith</var> can be used to check whether one string ends with another.


This page is [[under construction]].
==Syntax==
==Syntax==
{{Template:String:EndsWith syntax}}
{{Template:String:EndsWith syntax}}
===Syntax terms===
===Syntax terms===
<table class="syntaxTable">
<table class="syntaxTable">
<tr><th>%boolean</th><td><var>Boolean</var> value</td></tr>
<tr><th>%boolean</th>
<td>The <var>[[Boolean enumeration|Boolean]]</var> result is <var>True</var> if <var class="term">endString</var> is the same as the terminal characters of <var class="term">string</var>.</td></tr>
<tr><th>string</th>
<tr><th>string</th>
<td>string</td></tr>
<td>The method object string whose terminal characters are compared with <var class="term">endString</var>.</td></tr>
<tr><th>abbreviation</th>
<tr><th>endString</th><td>A string which is compared with the terminal characters of <var class="term">string</var>.</td></tr>
<td>string</td></tr>
</table>
</table>
==Usage notes==
==Usage notes==
<ul>
<li>If <var>endString</var> is a null (zero-length) string, <var>EndsWith</var> returns <var>True</var>.</li>
<li><var>endString</var> must be longer than 255 bytes. A longer <var>endString</var> results in request cancellation.</li>
</ul>
==Examples==
==Examples==
The following fragment:
<p class="code">printText {~= "abcdefg":endsWith("")}
printText {~= "abcdefg":endsWith("abcdefg")}
printText {~= "abcdefg":endsWith("xabcdefg")}
printText {~= "abcdefg":endsWith("def")}
</p>
produces the following output:
<p class="output">"abcdefg":endsWith("")= True       
"abcdefg":endsWith("abcdefg")= True 
"abcdefg":endsWith("xabcdefg")= False
"abcdefg":endsWith("def")= False   
</p>
==See also==
==See also==
{{Template:String:EndsWith footer}}
{{Template:String:EndsWith footer}}

Latest revision as of 03:35, 21 February 2020

Is the end string the terminal substring of the method object string? (String class)

[Introduced in Model 204 7.8 βeta]

EndsWith can be used to check whether one string ends with another.

Syntax

%boolean = string:EndsWith( endString)

Syntax terms

%boolean The Boolean result is True if endString is the same as the terminal characters of string.
string The method object string whose terminal characters are compared with endString.
endStringA string which is compared with the terminal characters of string.

Usage notes

  • If endString is a null (zero-length) string, EndsWith returns True.
  • endString must be longer than 255 bytes. A longer endString results in request cancellation.

Examples

The following fragment:

printText {~= "abcdefg":endsWith("")} printText {~= "abcdefg":endsWith("abcdefg")} printText {~= "abcdefg":endsWith("xabcdefg")} printText {~= "abcdefg":endsWith("def")}

produces the following output:

"abcdefg":endsWith("")= True "abcdefg":endsWith("abcdefg")= True "abcdefg":endsWith("xabcdefg")= False "abcdefg":endsWith("def")= False

See also