mirror of
https://github.com/TheAnachronism/docspell.git
synced 2025-06-22 10:28:27 +00:00
Using elm-format for all files
This commit is contained in:
@ -1,28 +1,45 @@
|
||||
module Util.String exposing (..)
|
||||
module Util.String exposing
|
||||
( crazyEncode
|
||||
, ellipsis
|
||||
, withDefault
|
||||
)
|
||||
|
||||
import Base64
|
||||
|
||||
crazyEncode: String -> String
|
||||
|
||||
crazyEncode : String -> String
|
||||
crazyEncode str =
|
||||
let
|
||||
b64 = Base64.encode str
|
||||
len = String.length b64
|
||||
b64 =
|
||||
Base64.encode str
|
||||
|
||||
len =
|
||||
String.length b64
|
||||
in
|
||||
case (String.right 2 b64 |> String.toList) of
|
||||
'=' :: '=' :: [] ->
|
||||
(String.dropRight 2 b64) ++ "0"
|
||||
case String.right 2 b64 |> String.toList of
|
||||
'=' :: '=' :: [] ->
|
||||
String.dropRight 2 b64 ++ "0"
|
||||
|
||||
_ :: '=' :: [] ->
|
||||
(String.dropRight 1 b64) ++ "1"
|
||||
_ :: '=' :: [] ->
|
||||
String.dropRight 1 b64 ++ "1"
|
||||
|
||||
_ ->
|
||||
b64
|
||||
_ ->
|
||||
b64
|
||||
|
||||
ellipsis: Int -> String -> String
|
||||
|
||||
ellipsis : Int -> String -> String
|
||||
ellipsis len str =
|
||||
if String.length str <= len then str
|
||||
else (String.left (len - 3) str) ++ "..."
|
||||
if String.length str <= len then
|
||||
str
|
||||
|
||||
withDefault: String -> String -> String
|
||||
else
|
||||
String.left (len - 3) str ++ "..."
|
||||
|
||||
|
||||
withDefault : String -> String -> String
|
||||
withDefault default str =
|
||||
if str == "" then default else str
|
||||
if str == "" then
|
||||
default
|
||||
|
||||
else
|
||||
str
|
||||
|
Reference in New Issue
Block a user