CARVIEW |
Select Language
HTTP/2 200
date: Sat, 11 Oct 2025 06:52:02 GMT
content-type: text/html; charset=UTF-8
server: cloudflare
x-frame-options: DENY
x-content-type-options: nosniff
x-xss-protection: 1;mode=block
vary: accept-encoding
cf-cache-status: DYNAMIC
content-encoding: gzip
set-cookie: _csrf-frontend=6e45e04a898a9f63ff88299b2f6d8a5d02769f450be2ecf1d25ab1f6d737ec1da%3A2%3A%7Bi%3A0%3Bs%3A14%3A%22_csrf-frontend%22%3Bi%3A1%3Bs%3A32%3A%228weDf07KWutfjtUHVvwlKyiaDgmkCcuC%22%3B%7D; HttpOnly; Path=/
cf-ray: 98cc6eb2882bb22e-BLR
Word combinations splitter GTK - Pastebin.com
SHARE
TWEET

Word combinations splitter GTK
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- The app reads a column of text from stdin. Some lines in the column
- -- may contain single words, some may contain word combinations. The
- -- app splits word combinations into separate words or leaves them as
- -- they are. It performs splitting either automatically or
- -- interactively, depending on the mode selected by the user with the
- -- help of a dialog window displayed at the launch.
- import Graphics.UI.Gtk
- import Control.Monad (void)
- import System.Exit (die)
- main :: IO ()
- main = do
- input <- getContents
- initialDialogResponse <- runDialog "Choose a mode: " "Split all" "Check all"
- case initialDialogResponse of
- 0 ->
- mapM_ (putStrLn . underscoresToSpaces . spacesToNewlines) $
- lines $ spaceBeforeBracket input
- 1 -> mapM_ processItem $ lines $ spaceBeforeBracket input
- 2 -> void (die "Aborted!")
- _ -> return ()
- spaceBeforeBracket :: String -> String
- spaceBeforeBracket [] = []
- spaceBeforeBracket [x] = [x]
- spaceBeforeBracket (x:y:ys)
- | x == ' ' && y == '(' = '_' : '(' : spaceBeforeBracket ys
- | otherwise = x : spaceBeforeBracket (y : ys)
- runDialog :: String -> String -> String -> IO Int
- runDialog dialogMessage buttonOne buttonTwo = do
- _ <- initGUI
- dialog <- dialogNew
- set
- dialog
- [ windowTitle := "Word combinations splitter"
- , windowDefaultWidth := 300
- , containerBorderWidth := 8
- ]
- label <- labelNew (Nothing :: Maybe String)
- labelSetMarkup label dialogMessage
- miscSetAlignment label 0.05 0
- upperPart <- dialogGetUpper dialog
- set upperPart [containerChild := label]
- button1 <- dialogAddButton dialog buttonOne (ResponseUser 0)
- button2 <- dialogAddButton dialog buttonTwo (ResponseUser 1)
- button3 <- dialogAddButton dialog "Abort" (ResponseUser 2)
- widgetShowAll dialog
- dialogExitStatus <- dialogRun dialog
- _ <- onClicked button1 mainQuit
- _ <- onClicked button2 mainQuit
- _ <- onClicked button3 mainQuit
- return $ (\(ResponseUser x) -> x) dialogExitStatus
- spacesToNewlines :: String -> String
- spacesToNewlines = map spaceToNewline
- where
- spaceToNewline x
- | x `elem` " \t" = '\n'
- | otherwise = x
- underscoresToSpaces :: String -> String
- underscoresToSpaces = map underscoreToSpace
- where
- underscoreToSpace x
- | x == '_' = ' '
- | otherwise = x
- processItem :: String -> IO ()
- processItem [] = return ()
- processItem string
- | ' ' `elem` string || '\t' `elem` string = do
- processedDialogResponse <-
- runDialog
- ("Check: <b>" ++ underscoresToSpaces string ++ "</b>")
- "Split"
- "Skip"
- case processedDialogResponse of
- 0 -> putStrLn $ underscoresToSpaces $ spacesToNewlines string
- 1 -> putStrLn $ underscoresToSpaces string
- 2 -> void (die "Aborted!")
- _ -> return ()
- | otherwise = putStrLn $ underscoresToSpaces string
Advertisement
Add Comment
Please, Sign In to add comment
-
⭐⭐⭐Swapzone.io Glitch (Working)⭐⭐
Java | 3 sec ago | 0.10 KB
-
⭐ Instant BTC Profit Method ✅ NEVER SEEN BEFO...
JavaScript | 3 sec ago | 0.24 KB
-
✅ Make $2500 in 20 minutes⭐⭐⭐ H
JavaScript | 4 sec ago | 0.24 KB
-
⭐✅ MAKE $2000 INSTANTLY ✅ NEVER SEEN BEFORE ⭐...
JavaScript | 12 sec ago | 0.24 KB
-
⭐⭐⭐Crypto Accounts⭐⭐
Java | 15 sec ago | 0.10 KB
-
⭐⭐Exchange Exploit⭐⭐ M
JavaScript | 15 sec ago | 0.24 KB
-
⭐ Free Crypto Method ✅ NEVER SEEN BEFORE ⭐⭐⭐
JavaScript | 21 sec ago | 0.24 KB
-
⭐⭐⭐MAKE $900 INSTANTLY⭐⭐
Java | 26 sec ago | 0.10 KB
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand