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.

func concatestr(_ str1: String, _ str2: String) -> String {
    var part1 = str1.characters
    var part2 = str2.characters
    part1.removeFirst()
    part2.removeFirst()
 
    return String(part1)+String(part2)
}
print(concatestr("ttech", "study"))
print(concatestr("pprogram", "ming"))

Result

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

Leave a Comment