jjinkou2
Well-Known Member
hi
here is a little toy program in haskell. it converts a text file with strings with numbers to a unicode file that can be printed.
The use : I just want to have a small paper in front of me with some of the best moves for my main. i copy a lot of juggles or combo in several forum in this form "236P , 4K" , and this program converts them into P, K
so in a file "input.txt" i put strings like
then in a terminal command i enter the following command:
and file test.txt contains the arrows in unicode.
compile the program with following command
i post this program here since it may interest inquiring minds ! more info here
http://learnyouahaskell.com/chapters
here is a little toy program in haskell. it converts a text file with strings with numbers to a unicode file that can be printed.
The use : I just want to have a small paper in front of me with some of the best moves for my main. i copy a lot of juggles or combo in several forum in this form "236P , 4K" , and this program converts them into P, K
so in a file "input.txt" i put strings like
Code:
6P+K 33P4P F 7P(CB) 113 damage
Fairly strict timing on the BKO cancel to CB
6P+K 8P SSP 7P(CB) 108 damage
SSP is a sit down stun
33P 8P SSP 7P(CB) 100 damage
SSP sit down stun.
33P 6PP 7P(CB) 100 damage
second hit of 6PP is a sit down stun
33P 3K 4PP 7P(CB) 107 damage
Everything can be held out of and it's all mid so be aware of that.
then in a terminal command i enter the following command:
Code:
cat input.txt | strToUtf8 > test.txt
and file test.txt contains the arrows in unicode.
compile the program with following command
Code:
ghc --make -O2 utf8v2.hs -o strToUtf8
i post this program here since it may interest inquiring minds ! more info here
http://learnyouahaskell.com/chapters
Code:
import Data.List
rightArr = "\x2192"
leftArr = "\x2190"
upArr = "\x2191"
downArr = "\x2193"
r_D_Arr = "\x2198"
l_D_Arr = "\x2199"
r_U_Arr = "\x2197"
l_U_Arr = "\x2196"
dict = [('1',l_D_Arr),('2',downArr),('3',r_D_Arr)
,('4',leftArr),('6',rightArr)
,('7',l_U_Arr),('8',upArr),('9',r_U_Arr)]
numtoUtf8 = concat . unfoldr translate
where translate [] = Nothing
translate (x:xs) = case str2 x of
Just (c,he) -> Just (he,xs)
Nothing -> Just ([x],xs)
where str2 n = find (\(val,_) -> val == n) dict
main :: IO ()
main = interact $ unlines.map numtoUtf8.lines