Write a Swift program that accept two strings and return their concatenation, except the first char of each string


Introduction

I have used Swift for windows 1.9 for debugging purpose. But you can use any Swift programming language compiler as per your availability.


techstudy.org

HP 15 Core i3 7th gen Laptop(4GB, 1TB HDD, Windows 10) | Rs. 31,490

  1. func concatestr(_ str1: String, _ str2: String) -> String {
  2. var part1 = str1.characters
  3. var part2 = str2.characters
  4. part1.removeFirst()
  5. part2.removeFirst()
  6.  
  7. return String(part1)+String(part2)
  8. }
  9. print(concatestr("ttech", "study"))
  10. print(concatestr("pprogram", "ming"))

Result

swift programming languages techstudy.org

     





Related Topics





Popular Posts