Write a Swift program to draw a HTML string as bold or italic text


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.


techstudy.org

HP 15 Core i3 7th gen Laptop(4GB, 1TB HDD, Windows 10) | Rs. 31,490

  1. func html_tags(_ tag: String, _ text: String) -> String {
  2. let opening_tag = "<\(tag)>"
  3. let closing_tag = ""
  4. return "\(opening_tag)\(text)\(closing_tag)"
  5. }
  6. print(html_tags("i", "HTML"))
  7. print(html_tags("b", "Swift"))

Result

swift programming languages techstudy.org

     





Related Topics





Popular Posts