String matching: Difference between revisions
m
→{{header|MIPS Assembly}}
Puppydrum64 (talk | contribs) |
Puppydrum64 (talk | contribs) |
||
Line 3,028:
=={{header|MIPS Assembly}}==
The function below returns the zero-based index where the string pointed to by <code>$a1</code> occurs in <code>$a0</code>.
* If it returns
* If it returns 0, then <
* If it returns <tt>strlen(
* Otherwise, <
* Multiple occurrences can be detected by adding the output to <tt>$a0</tt> and repeating the process; this is left as an exercise to the reader.
<lang mips>InString:
;input: $a0 = ptr to string 1
|