How to remove special characters from a string in apex.
Code: selectedStatus = ApexPages.currentPage().getParameters().get('ideaStatus');
value: ideastatus = "We like's it"
I want to remove the ' from the value of ideastatus.
I am trying selectedStatus.replace("'","");
But its not working.
Can anybody suggest how?
Try
selectedStatus.replace('\'', '')
However please note that "We like's it" is grammatically incorrect - it should be "We like it". So you shouldn't have to worry about the apostrophe in this case.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With