I need help! Substrings
turbosol <[email protected]> Tue, 29 May 2007 13:41:21 -0700 (PDT)
| Newsgroups | gmane.comp.lang.sml.smlnj |
|---|---|
| Message-ID | <[email protected]> |
So i signed up for my last compscience class so i can graduate... the class i
needed was canceled so i was put into a more difficult class for majors.
Comp science is my minor... anyways, I am currently doing twice the work i
would normally do in half the time. I am lost. if anyone can help me, i
would appreciate it SOOO much.
I need to write a function SubString : string * string -> int that checks
whether the first string is a substring of the second (case sensitive).
return the index position (starting from 0) if the string is a substring or
-1 otherwise. for multiple occurances, just return the index of the first
appearance. you may assume both input parameters are strings.
subString("ab","abcdefg")=> 1
subString("aaa","aaaa")=>0
subString("bc","absge") =>-1
subString("ab","cdabd") => 2
--
View this message in context: http://www.nabble.com/I-need-help%21--Substrings-tf3836438.html#a10862221
Sent from the SML/NJ mailing list archive at Nabble.com.
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/