OceanSonarWiki
Documentation for OceanSonarWiki.
OceanSonarWiki.KEEPTOKENS
OceanSonarWiki.styletextseps
OceanSonarWiki._styletext_casify_token
OceanSonarWiki._styletext_verify_style
OceanSonarWiki.pascaltext
OceanSonarWiki.snaketext
OceanSonarWiki.styletext
OceanSonarWiki.titletext
OceanSonarWiki.KEEPTOKENS
— ConstantOceanSonar.KEEPTOKENS
Used by styletext
. Vector
of String
s of english language words (tokens) to keep tokenised and keep their text styles (for certain text style conversions by styletext
).
OceanSonarWiki.styletextseps
— ConstantOceanSonar.styletextseps
Used by styletext
. NamedTuple
of separators (delimiters) for different text style types.
OceanSonarWiki._styletext_casify_token
— Method_styletext_casify_token(newstyle, token; keeptokens = OceanSonar.KEEPTOKENS)
Converts a single token to its specified newstyle
.
OceanSonarWiki._styletext_verify_style
— Method_styletext_verify_style
Used by styletext
. Verifies the request text style type.
OceanSonarWiki.pascaltext
— Methodtitletext(text) -> ::AbstractString
pascaltext(text) -> ::AbstractString
snaketext(text) -> ::AbstractString
Converts the inputted text
to the named text case style.
Convenience functions for styletext
, internally calls e.g. styletext(:title, text)
.
OceanSonarWiki.snaketext
— Methodtitletext(text) -> ::AbstractString
pascaltext(text) -> ::AbstractString
snaketext(text) -> ::AbstractString
Converts the inputted text
to the named text case style.
Convenience functions for styletext
, internally calls e.g. styletext(:title, text)
.
OceanSonarWiki.styletext
— Methodstyletext(
newstyle :: Union{Symbol, <:AbstractString},
oldtext :: Union{Symbol, <:AbstractString, <:Model{M}} where {M}
;
keeptokens :: AbstractVector{<:AbstractString} = OceanSonar.KEEPTOKENS
)
Converts oldtext
into the requested newstyle
text.
Implemented text styles:
:space
: Space-delimited tokens; tokens lowercased exceptkeeptokens
preserved.:Title
/:title
/:Space
: Space-delimited tokens; tokens' first character uppercased exceptkeeptokens
preserved.:Pascal
/:pascal
: No token delimiter; tokens' first character uppercased exceptkeeptokens
preserved.:camel
: As:pascal
but the very first character oftext
is lowercase.:Snake
: Underscore-delimited tokens; tokens' first character uppercased exceptkeeptokens
preserved.:snake
: Underscore-delimited tokens; tokens' first character lowercased exceptkeeptokens
preserved.:Kebab
: Hyphen-delimited tokens; tokens' first character uppercased exceptkeeptokens
.:kebab
: Hyphen-delimited tokens; tokens' first character lowercased exceptkeeptokens
.
Examples of implemented text styles:
:Space
:"Say 32 Big Goodbyes to 1 Cruel NSW 1st World"
:space
:"say 32 big goodbyes to 1 cruel NSW 1st world"
:pascal
:"Say32BigGoodbyesTo1CruelNSW1stWorld"
:camel
:"say32BigGoodbyesTo1CruelNSW1stWorld"
:Snake
:"Say_32_Big_Goodbyes_to_1_Cruel_NSW_1st_World"
:snake
:"say_32_big_goodbyes_to_1_cruel_NSW_1st_world"
:Kebab
:"Say-32-Big-Goodbyes-to-1-Cruel-NSW-1st-World"
:kebab
:"say-32-big-goodbyes-to-1-cruel-NSW-1st-world"
The title
case behaves differently from Base.Unicode.titlecase
, e.g.
julia> titlecase("say-32-big-goodbyes-to-1-cruel-NSW-1st-world")
"Say-32-Big-Goodbyes-To-1-Cruel-Nsw-1St-World"
julia> styletext(:title, "say-32-big-goodbyes-to-1-cruel-NSW-1st-world")
"Say 32 Big Goodbyes to 1 Cruel NSW 1st World"
The following convenience methods are also exported:
OceanSonarWiki.titletext
— Methodtitletext(text) -> ::AbstractString
pascaltext(text) -> ::AbstractString
snaketext(text) -> ::AbstractString
Converts the inputted text
to the named text case style.
Convenience functions for styletext
, internally calls e.g. styletext(:title, text)
.