Logo

Programming-Idioms

History of Idiom 46 > diff from v12 to v13

Edit summary for version 13 by :

Version 12

2015-09-02, 13:57:33

Version 13

2015-09-02, 15:06:40

Idiom #46 Extract beginning of string (prefix)

Create string t consisting of the 5 first characters of string s.

Idiom #46 Extract beginning of string (prefix)

Create string t consisting of the 5 first characters of string s.

Imports
import qualified Data.Text as T
Code
t :: T.Text
t = T.take 5 s
Comments bubble
This implementation uses the Text type, imported as suggested in the Text library documentation.