locked
Newbie string issue RRS feed

  • 問題

  • Hi

    In my token string I am getting extra \" on both ends and this fails subsequent calls to remote API for data. Even though I am using 

    oauthToken1 = oauthToken2.Replace("\\\"", "");


    to strip \" from both ends. Screen 1 below.

    The Output window however shows string fine. Screen 2 below.

    At present I manually edit out the \" from both ends in Watch window and get the subsequent API calls to succeed.

    How can I get rid of \" on both ends please and why do they appear in the first place?

    Thanks

    Regards

    Screen 1 

    Screen 2


    • 已編輯 Y a h y a 2020年9月2日 下午 04:57
    2020年9月2日 下午 04:56

解答

  • Try this too: oauthToken1 = oauthToken2.Trim('"') (i.e. apostrophe, quotation mark, apostrophe).

    To view the string, you can also type this expression into Watch window:

       oauthToken1,nq

    • 已標示為解答 Y a h y a 2020年9月2日 下午 08:09
    2020年9月2日 下午 06:51

所有回覆

  • Try:

    oauthToken1 = oauthToken2.Replace(@"\"", "");


    Looking for new opportunities

    For every expert, there is an equal and opposite expert. - Becker's Law


    My blog


    My TechNet articles

    2020年9月2日 下午 06:28
  • Try this too: oauthToken1 = oauthToken2.Trim('"') (i.e. apostrophe, quotation mark, apostrophe).

    To view the string, you can also type this expression into Watch window:

       oauthToken1,nq

    • 已標示為解答 Y a h y a 2020年9月2日 下午 08:09
    2020年9月2日 下午 06:51