locked
replace " RRS feed

  • Question

  • when i look into my list and recieve the field data.

    i recieve "30""

    the output must be 30".

    i'm dooing the following, but my result is 30\".

    String modifyWord = SPEncode.HtmlEncode(proditem["code number"].ToString());
    String productCodeNumber = modifyWord.Replace(""", "\"");

    what im i dooing wrong?

     

    Tuesday, November 16, 2010 12:49 PM

Answers

  • If you're looking at the string in the immediate window the output will be escaped. I just ran the following code and it worked fine:

          String modifyWord = SPEncode.HtmlDecode("30"");
          Label label = new Label();
          label.Text = modifyWord;
          Controls.Add(label);
    
    Set a breakpoint on the code that doesn't work, then in your immediate window type proditem["code number"].ToString() and hit return - what do you get?
    • Marked as answer by kimvlas Wednesday, November 17, 2010 7:17 AM
    Wednesday, November 17, 2010 2:25 AM

All replies

  • Hi,

    Sorry for this silly question.

    How did you check the result? Did you print it out to console or whatever?

    If you checked it in Watch in VS it suppose to be shown as 30\" when it was 30".

    Regards,

     

     

     


    Vladimir
    MSTS, SharePoint tips blog: http://buyevich.blogspot.com
    Tuesday, November 16, 2010 2:51 PM
  • there is no silly questions :).

    i have print it out on the console and in my program.

    i think that was the code for changing some carracters.

    Tuesday, November 16, 2010 3:00 PM
  • If you're looking at the string in the immediate window the output will be escaped. I just ran the following code and it worked fine:

          String modifyWord = SPEncode.HtmlDecode("30"");
          Label label = new Label();
          label.Text = modifyWord;
          Controls.Add(label);
    
    Set a breakpoint on the code that doesn't work, then in your immediate window type proditem["code number"].ToString() and hit return - what do you get?
    • Marked as answer by kimvlas Wednesday, November 17, 2010 7:17 AM
    Wednesday, November 17, 2010 2:25 AM
  • that code works, i havent changed anyting serias and it also works with me.

    i recieve also the 30\".

    but when i then check if this value can be found in a dropdown box its fixed, thankx.

    Wednesday, November 17, 2010 7:17 AM