Skip to content

Instantly share code, notes, and snippets.

@volkanbicer
Created November 10, 2017 05:10
Show Gist options
  • Save volkanbicer/5578878691c400457c456ccf2641c574 to your computer and use it in GitHub Desktop.
Save volkanbicer/5578878691c400457c456ccf2641c574 to your computer and use it in GitHub Desktop.
Function that takes a string as input and returns the string reversed.
func reverseString(_ s: String) -> String {
var reversed = ""
var stringArray = Array(s.characters)
var n = s.characters.count
for i in 0..<stringArray.count{
reversed.append(stringArray[n-1-i])
}
return reversed
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment