I have a string in the form of
"@{profile: id1} is going to @{profile: id2}'s party"
How do I convert it to nsattributedstring
"**Name1** is going to **Name2**'s party"
Both id1
and id2
represent a string.
You can get Name1
by pass id1
into a function named getName(by id: String)
Given a string
"@{profile: 735bcec0-1470-11e9-8384-a57f51e70e5f} is \
going to @{profile: 4c0bf620-2022-11e9-99ad-0777e9298bfb} party."
Assume
getName(by: "735bcec0-1470-11e9-8384-a57f51e70e5f") -> "Jack"
getName(by: "4c0bf620-2022-11e9-99ad-0777e9298bfb") -> "Rose"
I would like to get back a nsattributedstring
"Jack is going to Rose's party"
Where both Jack
and Rose
should be bold.