我有一个文件,我们称之为'a.txt',这个文件包含以下文本行
do to what
Run Code Online (Sandbox Code Playgroud)
我想知道SED命令是什么来反转这个文本的顺序使它看起来像
what to do
Run Code Online (Sandbox Code Playgroud)
我必须做某种追加吗?就像将'do'追加到'to'所以它看起来像
to ++ do(使用++只是为了清楚)
我正在尝试将我的java程序翻译成Haskell.我的目标是将我的字符串拆分成几个字符串并将它们放在一个列表中.
到目前为止这是我的代码
import Char
import IO
import Text.Regex
translate :: String -> Int
translate input =
testcode(splitRegex (mkRegex "\\s") input)
Run Code Online (Sandbox Code Playgroud)
testcode会根据第一个值进行一些测试,例如(在飞行中做到这一点还没有到目前为止)
testcode :: [String] -> Int -> Int
testcode [] 0
testcode (x:xs) n
|(x=="test") = 1
|otherwise = testcode xs
Run Code Online (Sandbox Code Playgroud)
我一直得到的编译错误如下:
Could not find module `Text.Regex'
Perhaps you meant Text.Read (from base)
Run Code Online (Sandbox Code Playgroud)
如何导入Text.Regex?