Answer the question
In order to leave comments, you need to log in
Haskell String Functions?
I work with text encryption, I need to write 2 functions, it doesn’t work out in any way, one should take all the characters except letters, the second should return these characters already in the new text. (Letters in one case, only capitals) For example:
I'M GOING, I WILL BE SOON. "HELLO WORLD!"
GOOD NIGHT
...
After the first function the following line is obtained:
I think even 3 functions are needed, the first one returns a list of pairs String -> [(Char, Int)] Where it writes the character and its number in the string, ignoring Letters. The second one returns a string without characters, only letters, well, this function is easy, you don't need help with it)) String -> String
Well, the third function is according to the list of pairs, and the resulting string puts all the characters in their places.
String -> [(Char, Int)] -> String
Please help, it doesn't work(
Answer the question
In order to leave comments, you need to log in
I don’t know about Russian, but the first function (then you called it second) is a filter:
import Data.Char
f1 = filter isAlpha -- или isLetter
> f1 "a,b,c"
> "abc"
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question