Jump to content

String matching: Difference between revisions

m
Added Nimrod code
m (Siskus moved page Character matching to String matching: "Character matching" refers to type character, while a structure of string of characters is ment.)
m (Added Nimrod code)
Line 1,124:
 
----
=={{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|Objective-C}}==
118

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.