String comparison: Difference between revisions
Content added Content deleted
(Added Erlang) |
m (Added Nimrod code) |
||
Line 521: | Line 521: | ||
</lang> |
</lang> |
||
The list of strict comparison operators described in the [[#REXX|REXX]] sample apply to [[NetRexx]] too. |
The list of strict comparison operators described in the [[#REXX|REXX]] sample apply to [[NetRexx]] too. |
||
=={{header|Nimrod}}== |
|||
<lang nimrod>import strutils |
|||
var s: string = "The quick brown fox" |
|||
if startsWith(s, "The quick"): |
|||
echo("Starts with: The quick") |
|||
if endsWith(s, "brown Fox"): |
|||
echo("Ends with: brown fox") |
|||
var pos = find(s, " brown ") # -1 if not found |
|||
if contains(s, " brown "): # showing the contains() proc, but could use if pos!=-1: |
|||
echo('"' & " brown " & '"' & " is located at position: " & $pos)</lang> |
|||
{{out}} |
|||
<pre>Starts with: The quick |
|||
Ends with: brown fox |
|||
" brown " is located at position: 9</pre> |
|||
=={{header|ooRexx}}== |
=={{header|ooRexx}}== |