Converts characters in a string into their corresponding phonetic representations using either the NATO phonetic alphabet or Morse code.
Usage
strSpell(x, upr = "CAP", type = c("NATO", "Morse"))Details
Letters (A–Z, a–z) and digits (0–9) are mapped to their corresponding phonetic representations. Other characters are returned unchanged.
For type = "NATO", uppercase letters can optionally be prefixed
(e.g., "CAP Alfa") to distinguish them from lowercase letters.
The function uses Unicode-aware character splitting via
stringi::stri_split_boundaries().
See also
strTrim(),
stringi::stri_split_boundaries()
string-overview for an overview of all string utilities in pharos.
Examples
# NATO spelling
strSpell("ABC")
#> [1] "CAP Alfa" "CAP Bravo" "CAP Charlie"
# with digits
strSpell("A1B2")
#> [1] "CAP Alfa" "One" "CAP Bravo" "Two"
# Morse code
strSpell("SOS", type = "Morse")
#> [1] "..." "---" "..."
# without uppercase prefix
strSpell("ABC", upr = NA)
#> [1] "Alfa" "Bravo" "Charlie"
