Demo entry 6355937

displayTranslation

   

Submitted by anonymous on Apr 14, 2017 at 14:43
Language: Swift. Code size: 1.0 kB.

func displayTranslation(){
        let arrayOfString = Array(originalString.characters)
        
        for i in(0..<arrayOfString.count).reversed(){
            var character: Character = arrayOfString[i]
            
            //Need to take into account every other character on keyboard
            if character == " "{
                character = "5"
            }else if character == "J" || character == "Y" {
                character = "I"
            }else if character == "K"{
                character = "Q"
            }else if character == "W"{
                character = "U"
            }else if character == "X"{
                character = "S"
            }else if character == "V"{
                character = "F"
            }else if character == "G" && arrayOfString[i-1] == "N"{
                character = "!"
            }else if character == "N" && arrayOfString[i+1] == "G"{
                continue
            }
            
            displayImage(character: character)
        }
    }

This snippet took 0.01 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).