Difference between revisions of "Cum se extrage un substring"

From HaskellWiki
Jump to: navigation, search
m
 
Line 6: Line 6:
 
</haskell>
 
</haskell>
   
Main Data.Text> substring 2 6 "alfaville"
+
Main Data.Text> substring 2 6 "alfaville" <br>
"favi"
+
"favi" <br>
 
Main Data.Text>
 
Main Data.Text>

Latest revision as of 12:48, 9 October 2019

Ori cautati o functie din biblioteca ori scrieti dvs una:

substring :: Int -> Int -> String -> String
substring start end text = take (end - start) (drop start text)

Main Data.Text> substring 2 6 "alfaville"
"favi"
Main Data.Text>