Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Sub changeString()
- Dim inString As String
- Dim outString As String
- 'create a dictionary object to hold our phonetic alphabet
- Dim phoneticDict As Object
- Set phoneticDict = CreateObject("Scripting.Dictionary")
- phoneticDict.Add Key:="A", Item:="Alfa"
- phoneticDict.Add Key:="B", Item:="Bravo"
- phoneticDict.Add Key:="C", Item:="Charlie"
- phoneticDict.Add Key:="D", Item:="Delta"
- phoneticDict.Add Key:="E", Item:="Echo"
- phoneticDict.Add Key:="F", Item:="Foxtrot"
- phoneticDict.Add Key:="G", Item:="Golf"
- phoneticDict.Add Key:="H", Item:="Hotel"
- phoneticDict.Add Key:="I", Item:="India"
- phoneticDict.Add Key:="J", Item:="Juliett"
- phoneticDict.Add Key:="K", Item:="Kilo"
- phoneticDict.Add Key:="L", Item:="Lima"
- phoneticDict.Add Key:="M", Item:="Mike"
- phoneticDict.Add Key:="N", Item:="November"
- phoneticDict.Add Key:="O", Item:="Oscar"
- phoneticDict.Add Key:="P", Item:="Papa"
- phoneticDict.Add Key:="Q", Item:="Quebec"
- phoneticDict.Add Key:="R", Item:="Romeo"
- phoneticDict.Add Key:="S", Item:="Sierra"
- phoneticDict.Add Key:="T", Item:="Tango"
- phoneticDict.Add Key:="U", Item:="Uniform"
- phoneticDict.Add Key:="V", Item:="Victor"
- phoneticDict.Add Key:="W", Item:="Whiskey"
- phoneticDict.Add Key:="X", Item:="X-ray"
- phoneticDict.Add Key:="Y", Item:="Yankee"
- phoneticDict.Add Key:="Z", Item:="Zulu"
- 'define the string we are flipping out
- inString = "cp:!zhE*zGgU'wX[Zinc study]"
- 'grab the first letter and get the dictionary value
- outString = phoneticDict(UCase(Left(inString, 1)))
- 'Get everything between the ":" and "["
- outString = outString & Split(Split(inString, ":")(1), "[")(0)
- 'And now get the second letter and use the dictionary to find it's word
- outString = outString & phoneticDict(UCase(Mid(inString, 2, 1)))
- Debug.Print outString
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement