Remove last special character if last character is question mark. First we have to check the last character in given string is question mark or not. If last character is question mark then we remove the last character.
You can remove any last specific character if it exists at last position with the help of given example using c#. This function will retrurn text without special charcter ?.
public static string RemoveLastSpecialCharcter(string text)
{
var last_character = text[text.Length - 1];
if (last_character == '?')
{
text = text.Remove(text.Length - 1);
}
return text;
}
Post your comments / questions
Recent Article
- How to enable Search Feature in Django admin?
- How to check PAN-Aadhaar is Linked or NOT?
- How to customize pagination for django admin?
- How to fix HAXM is not installed |in Android Studio
- How to fix CMOS Checksum Error in Computer or Laptop | SOLVED
- Reactivating windows after a Hardware change on PC or Laptop
- FIXED: Windows reported that the hardware of your device has changed. Error code :0xc004F211
- "redirect" is not defined pylance("reportUndefinedVariable)
Related Article