我需要使用split
foldr
split :: Eq a ⇒ a → [a] → [[ a ]]
示例:
split '/' ”hello/my/friends” ----> [”hello”,”my”,”friends”]
这是我尝试过的:
split :: Eq a ⇒ a → [a] → [[ a ]]
split str delim = let (start, end) = break (== delim) str
in start : if null end then [] else groupBy (tail end) delim
答案 0 :(得分:4)
这样的事情应该有效:
split on = foldr (\c (x:xs) ->
if c == on
then []:x:xs
else (c:x):xs
) [[]]
广义:
public void onStop() {
super.onStop();
// code where you tell the app to save the image
}
public void onDestroy() {
super.onDestroy();
// code where you tell the app to save the image
}