Update all new Tasks
This commit is contained in:
parent
00a190b0a6
commit
91df62d461
5697 changed files with 93386 additions and 804 deletions
12
Task/String-matching/Haskell/string-matching-1.hs
Normal file
12
Task/String-matching/Haskell/string-matching-1.hs
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
> import Data.List
|
||||
> "abc" `isPrefixOf` "abcdefg"
|
||||
True
|
||||
> "efg" `isSuffixOf` "abcdefg"
|
||||
True
|
||||
> "bcd" `isInfixOf` "abcdefg"
|
||||
True
|
||||
> "abc" `isInfixOf` "abcdefg" -- Prefixes and suffixes are also infixes
|
||||
True
|
||||
> let infixes a b = findIndices (isPrefixOf a) $ tails b
|
||||
> infixes "ab" "abcdefabqqab"
|
||||
[0,6,10]
|
||||
Loading…
Add table
Add a link
Reference in a new issue