Swift String Exercises: Create a new string taking the middle two characters of a given string of even length
Write a Swift program to create a new string taking the middle two characters of a given string of even length. The given string length must be at least 2.
Pictorial Presentation:

Sample Solution:
Swift Code:
Sample Output:
th av
Swift Programming Code Editor:
Improve this sample solution and post your code through Disqus
Previous: Write a Swift program to create a new string without the first and last character of a given string. The string may be any length, including 0.
Next: Write a Swift program to test if a given string starts with "ab".
What is the difficulty level of this exercise?