locked
String.Replace is not working RRS feed

  • Question

  • User-1971168174 posted

    Hi,

    Can someone help me in finding how to replace single quote with backslash single quote.

    Here single quote before L is not getting replaced with \'

    string test1 = "neeraj TPs/INT'L";
    string tets2 = test1.Replace("'", "\'");

    Desired Output: "neeraj TPs/INT\'L"

    Thanks!

    Wednesday, July 29, 2020 6:48 AM

Answers

  • User-2121988648 posted

    This should help 

    string test1 = "neeraj TPs/INT'L";
    string tets2 = test1.Replace("'", "\\'");

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, July 29, 2020 7:52 AM