Step-1

First, create a simple playground file from Xcode like the below screenshots.

Step-2

Import the Foundation at the type and then start typing the next code.

Step-3

Now create a text var and put some text into that var

Step-4

Create a function getHighlightedString function which will get two String parameters…

M.Abbas

I am a professional software engineer.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store