Tutorial by Examples: e

{-# LANGUAGE OverloadedStrings #-} import qualified Data.Text as T myText :: T.Text myText = "mississippi" splitOn breaks a Text up into a list of Texts on occurrences of a substring. ghci> T.splitOn "ss" myText ["mi","i","ippi"] sp...
Encoding and decoding functions for a variety of Unicode encodings can be found in the Data.Text.Encoding module. ghci> import Data.Text.Encoding ghci> decodeUtf8 (encodeUtf8 "my text") "my text" Note that decodeUtf8 will throw an exception on invalid input. If you wa...
By default, GHCI's prompt shows all the modules you have loaded into your interactive session. If you have many modules loaded this can get long: Prelude Data.List Control.Monad> -- etc The :set prompt command changes the prompt for this interactive session. Prelude Data.List Control.Monad&g...
GHCi uses a configuration file in ~/.ghci. A configuration file consists of a sequence of commands which GHCi will execute on startup. $ echo ":set prompt \"foo> \"" > ~/.ghci $ ghci GHCi, version 8.0.1: http://www.haskell.org/ghc/ :? for help Loaded GHCi configuration...
The :l or :load command type-checks and loads a file. $ echo "f = putStrLn \"example\"" > example.hs $ ghci GHCi, version 8.0.1: http://www.haskell.org/ghc/ :? for help ghci> :l example.hs [1 of 1] Compiling Main ( example.hs, interpreted ) Ok, modules ...
(u)gettext_noop allows you to mark a string as translatable without actually translating it. A typical use case is when you want to log a message for developers (in English) but also want to display it to the client (in the requested language). You can pass a variable to gettext, but its content wo...
Find usages / Find usages in file Windows / Linux: Alt + F7 / Ctrl + F7 OS X / macOS: Option + F7 / Ctrl + F7 Highlight usages in file Windows / Linux: Ctrl + Shift + F7 OS X / macOS: Cmd + Shift + F7 Show usages Windows / Linux: Ctrl + Alt + F7 OS X / macOS: Cmd + Option + F7
Windows / Linux: Ctrl + P OS X / macOS: Cmd + P Shows what parameters a method and all of its overloads accepts.
The fourth version of the framework focuses mainly on making mobile web application development easier. New features in AP.NET MVC 4 ASP.NET Web API ASP.NET Web API is a framework that makes it easy to build HTTP services that reach a broad range of clients, including browsers and mobile devi...
Lets suppose you have 2 Lists A and B, and you want to remove from B all the elements that you have in A the method in this case is List.removeAll(Collection c); #Example: public static void main(String[] args) { List<Integer> numbersA = new ArrayList<>(); List<Intege...
Regular Map A map is an associative container, containing key-value pairs. #include <string> #include <map> std::map<std::string, size_t> fruits_count; In the above example, std::string is the key type, and size_t is a value. The key acts as an index in the map. Each key mu...
Reverse elements within a tuple colors = "red", "green", "blue" rev = colors[::-1] # rev: ("blue", "green", "red") colors = rev # colors: ("blue", "green", "red") Or using reversed (reversed gives an it...
def str = 'Single quoted string' assert str instanceof String
def str = "Double quoted string" assert str instanceof String
def param = 'string' def str = "Double quoted ${param}" assert str instanceof GString assert str == 'Double quoted string' The parameter is by default resolved eagerly, this means this applies: def param = 'string' def str = "Double quoted ${param}" param = 'another stri...
def str = '''multiline string''' assert str instanceof String
def str = ''' multiline string''' assert str.readLines().size() == 3
def str = '''\ multiline string''' assert str.readLines().size() == 2
def param = 'string' def str = """ multiline $param """ assert str instanceof GString assert str.readLines().size() == 3 assert str == ''' multiline string '''
def str = / multiline string no need to escape slash \n / assert str instanceof String assert str.readLines().size() == 4 assert str.contains('\\n')

Page 399 of 1191