swift-PartiallyHiddenString
Project to study Swift
Table of Contents
Create a function that takes a phrase and transforms each word using the following rules:
Keep first and last character the same.
Transform middle characters into a dash -.
Examples:
partiallyHide("skies were pretty") ➞ "s---s w--e p----y"
partiallyHide("red is not my color") ➞ "r-d is n-t my c---r"
partiallyHide("She rolled her eyes") ➞ "S-e r----d h-r e--s"
partiallyHide("Harry went to fight the basilisk") ➞ "H---y w--t to f---t t-e b------k"
Notes:
Words with two or fewer letters should not be hidden at all.
Excercise from: https://edabit.com/challenges/swift
Open the file PartiallyHiddenString.xcodeproj
- Xcode 12.4
- Use iPhone 12 mini as simulator
Daniel Washington Ignacio - danielvertigo@hotmail.com
Click to access my LinkedIn