Tag: Reverse String

  • Reverse a String in Swift

    Here is a simple code snippet written in Swift programming language for reversing a string. import Cocoa //Assigning a value to a String variable var str = “Hello, playground” //Create empty character Array. var strArray:Character[] = Character[]() //Loop through each character in the String for character in str { //Insert the character in the Array…