Utilities

Utilities

Types

Reference

julia> import BibTeXFormat: BibTeXString

julia> a = BibTeXString("{aaaa{bbbb{cccc{dddd}}}ffff}");

julia> convert(String,a ) == "{aaaa{bbbb{cccc{dddd}}}ffff}"
true
source

Abbreviate the given text.

julia> import BibTeXFormat.abbreviate

julia> abbreviate("Name")
"N."

julia> abbreviate("Some words")
"S. w."

julia> abbreviate("First-Second")
"F.-S."
source
function bibtex_abbreviate(string, delimiter=None, separator='-')

Abbreviate string.

julia> import BibTeXFormat: bibtex_abbreviate

julia> print(bibtex_abbreviate("Andrew Blake"))
A
julia> print(bibtex_abbreviate("Jean-Pierre"))
J.-P
julia> print(bibtex_abbreviate("Jean--Pierre"))
J.-P
source
function bibtex_substring(string, start, length)

Return a substring of the given length, starting from the given position.

start and length are 1-based. If start is < 0, it is counted from the end of the string. If start is 0, an empty string is returned.

julia> import BibTeXFormat: bibtex_substring

julia> print(bibtex_substring("abcdef", 1, 3))
abc
julia> print(bibtex_substring("abcdef", 2, 3))
bcd
julia> print(bibtex_substring("abcdef", 2, 1000))
bcdef
julia> print(bibtex_substring("abcdef", 0, 1000))

julia> print(bibtex_substring("abcdef", -1, 1))
f
julia> print(bibtex_substring("abcdef", -1, 2))
ef
julia> print(bibtex_substring("abcdef", -2, 3))
cde
julia> print(bibtex_substring("abcdef", -2, 1000))
abcde
source
function change_case(string, mode)
julia> import BibTeXFormat: change_case

julia> print(change_case("aBcD", 'l'))
abcd
julia> print(change_case("aBcD", 'u'))
ABCD
julia> print(change_case("ABcD", 't'))
Abcd
julia> change_case("The {\TeX book \noop}", 'u')
"THE {\TeX BOOK \noop}"

julia> change_case("And Now: BOOO!!!", 't')
"And now: Booo!!!"

julia> change_case("And {Now: BOOO!!!}", 't')
"And {Now: BOOO!!!}"

julia> change_case("And {Now: {BOOO}!!!}", 'l')
"and {Now: {BOOO}!!!}"

julia> change_case("And {\Now: BOOO!!!}", 't')
"And {\Now: booo!!!}"

julia> change_case("And {\Now: {BOOO}!!!}", 'l')
"and {\Now: {booo}!!!}"

julia> change_case("{\TeX\ and databases\Dash\TeX DBI}", 't')
"{\TeX\ and databases\Dash\TeX DBI}"
source

Yield (char, brace_level) tuples.

"Special characters", as in bibtex_len, are treated as a single character

source

Split a text keep the separators

julia> import BibTeXFormat.split_keep_separator

julia> split_keep_separator("Some words-words")
5-element Array{Any,1}:
 "Some"
 ' '
 "words"
 '-'
 "words"
source

Split a list of names, separated by ' and '.

julia> import BibTeXFormat.split_name_list

julia> split_name_list("Johnson and Peterson")
2-element Array{SubString{String},1}:
 "Johnson"
 "Peterson"

julia> split_name_list("Johnson AND Peterson")
2-element Array{SubString{String},1}:
 "Johnson"
 "Peterson"

julia> split_name_list("Johnson AnD Peterson")
2-element Array{SubString{String},1}:
 "Johnson"
 "Peterson"

julia> split_name_list("Armand and Peterson")
2-element Array{SubString{String},1}:
 "Armand"
 "Peterson"

julia> split_name_list("Armand and anderssen")
2-element Array{SubString{String},1}:
 "Armand"
 "anderssen"

julia> split_name_list("{Armand and Anderssen}")
1-element Array{SubString{String},1}:
 "{Armand and Anderssen}"

julia> split_name_list("What a Strange{ }and Bizzare Name! and Peterson")
2-element Array{SubString{String},1}:
 "What a Strange{ }and Bizzare Name!"
 "Peterson"

julia> split_name_list("What a Strange and{ }Bizzare Name! and Peterson")
2-element Array{SubString{String},1}:
 "What a Strange and{ }Bizzare Name!"
 "Peterson"
source