Advertisement
Guest User

Untitled

a guest
Jan 3rd, 2019
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Sub changeString()
  2.     Dim inString As String
  3.     Dim outString As String
  4.    
  5.     'create a dictionary object to hold our phonetic alphabet
  6.    Dim phoneticDict As Object
  7.     Set phoneticDict = CreateObject("Scripting.Dictionary")
  8.     phoneticDict.Add Key:="A", Item:="Alfa"
  9.     phoneticDict.Add Key:="B", Item:="Bravo"
  10.     phoneticDict.Add Key:="C", Item:="Charlie"
  11.     phoneticDict.Add Key:="D", Item:="Delta"
  12.     phoneticDict.Add Key:="E", Item:="Echo"
  13.     phoneticDict.Add Key:="F", Item:="Foxtrot"
  14.     phoneticDict.Add Key:="G", Item:="Golf"
  15.     phoneticDict.Add Key:="H", Item:="Hotel"
  16.     phoneticDict.Add Key:="I", Item:="India"
  17.     phoneticDict.Add Key:="J", Item:="Juliett"
  18.     phoneticDict.Add Key:="K", Item:="Kilo"
  19.     phoneticDict.Add Key:="L", Item:="Lima"
  20.     phoneticDict.Add Key:="M", Item:="Mike"
  21.     phoneticDict.Add Key:="N", Item:="November"
  22.     phoneticDict.Add Key:="O", Item:="Oscar"
  23.     phoneticDict.Add Key:="P", Item:="Papa"
  24.     phoneticDict.Add Key:="Q", Item:="Quebec"
  25.     phoneticDict.Add Key:="R", Item:="Romeo"
  26.     phoneticDict.Add Key:="S", Item:="Sierra"
  27.     phoneticDict.Add Key:="T", Item:="Tango"
  28.     phoneticDict.Add Key:="U", Item:="Uniform"
  29.     phoneticDict.Add Key:="V", Item:="Victor"
  30.     phoneticDict.Add Key:="W", Item:="Whiskey"
  31.     phoneticDict.Add Key:="X", Item:="X-ray"
  32.     phoneticDict.Add Key:="Y", Item:="Yankee"
  33.     phoneticDict.Add Key:="Z", Item:="Zulu"
  34.  
  35.     'define the string we are flipping out
  36.    inString = "cp:!zhE*zGgU'wX[Zinc study]"
  37.    
  38.     'grab the first letter and get the dictionary value
  39.    outString = phoneticDict(UCase(Left(inString, 1)))
  40.    
  41.     'Get everything between the ":" and "["
  42.    outString = outString & Split(Split(inString, ":")(1), "[")(0)
  43.  
  44.     'And now get the second letter and use the dictionary to find it's word
  45.    outString = outString & phoneticDict(UCase(Mid(inString, 2, 1)))
  46.    
  47.     Debug.Print outString
  48.    
  49. End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement