Removes HTML markup from string in Salesforce using Apex

Sample Code:

String str1 = '<b>Hello World</b>';
String str2 = str1.stripHtmlTags();
System.Debug(str2);