String matching: Difference between revisions
Content deleted Content added
m →{{header|Javascript}}: Fix case |
added standard ml |
||
Line 1,058: | Line 1,058: | ||
loc = "abab".indexOf("ab") //returns 0 |
loc = "abab".indexOf("ab") //returns 0 |
||
loc = "abab".indexOf("ab", loc+1) //returns 2</lang> |
loc = "abab".indexOf("ab", loc+1) //returns 2</lang> |
||
=={{header|Standard ML}}== |
|||
<lang sml>String.isPrefix "ab" "abcd"; (* returns true *) |
|||
String.isSuffix "zn" "abcd"; (* returns false *) |
|||
String.isSubstring "bb" "abab"; (* returns false *) |
|||
String.isSubstring "ab" "abab"; (* returns true *) |
|||
#2 (Substring.base (#2 (Substring.position "bb" (Substring.full "abab")))); (* returns 4 *) |
|||
val loc = #2 (Substring.base (#2 (Substring.position "ab" (Substring.full "abab")))); (* returns 0 *) |
|||
val loc' = #2 (Substring.base (#2 (Substring.position "ab" (Substring.extract ("abab", loc+1, NONE))))); (* returns 2 *)</lang> |
|||
=={{header|Tcl}}== |
=={{header|Tcl}}== |