1

I'm rewriting a library from java which uses something like

public int myFunc(char c){
 return c+200
}

because in java 'a' + 1 will be 'b'

in Swift I cannot simply add an Int to a Character. Google search doesn't know anything about that.

Vlad Alexeev
  • 2,072
  • 6
  • 29
  • 59

1 Answers1

0

Swift is a Strong Type Language. So the typecast is strict.

If you get ASCII value, you can like this:

let asciiValues = string.utf8.map{ Int($0) }

I hope that helps.

W.venus
  • 470
  • 2
  • 6
  • 19