trim a single quote from string

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Mitch

    trim a single quote from string

    I have been trying to use TrimEnd() to eliminate a single quote from the end
    of a string. I have used "'", ''', and a few others without success. Does
    anyone have experience with TrimEnd()?
  • Kevin Spencer

    #2
    Re: trim a single quote from string

    The method takes an array of characters as its argument.

    --
    HTH,

    Kevin Spencer
    Microsoft MVP
    Chicken Salad Surgery

    What You Seek Is What You Get.

    "Mitch" <Mitch@discussi ons.microsoft.c omwrote in message
    news:E3490091-8385-4148-B9B4-5692A7D02F9A@mi crosoft.com...
    >I have been trying to use TrimEnd() to eliminate a single quote from the
    >end
    of a string. I have used "'", ''', and a few others without success.
    Does
    anyone have experience with TrimEnd()?

    Comment

    • Alan T

      #3
      Re: trim a single quote from string

      How to define an array of characters ?

      "Kevin Spencer" <uce@ftc.govwro te in message
      news:ujmhQTe1GH A.2036@TK2MSFTN GP05.phx.gbl...
      The method takes an array of characters as its argument.
      >
      --
      HTH,
      >
      Kevin Spencer
      Microsoft MVP
      Chicken Salad Surgery
      >
      What You Seek Is What You Get.
      >
      "Mitch" <Mitch@discussi ons.microsoft.c omwrote in message
      news:E3490091-8385-4148-B9B4-5692A7D02F9A@mi crosoft.com...
      >>I have been trying to use TrimEnd() to eliminate a single quote from the
      >>end
      >of a string. I have used "'", ''', and a few others without success.
      >Does
      >anyone have experience with TrimEnd()?
      >
      >

      Comment

      • Jon Skeet [C# MVP]

        #4
        Re: trim a single quote from string

        Alan T <alanpltseNOSPA M@yahoo.com.auw rote:
        How to define an array of characters ?
        In the case of TrimEnd, you can specify the array just by giving the
        characters, or the single character in your case:

        x.TrimEnd ('\'');

        That's because the parameter is declared with the "params" modifier.
        Otherwise you'd have to do:

        x.TrimEnd (new char[] { '\'' });

        I would *strongly* recommend that if you're still fairly unfamiliar
        with C# that you lean the basics thoroughly before moving onto things
        like threading and GUI code. Threading can be tricky at the best of
        times, but you'll find it a lot harder if you're still trying to get to
        grips with the language itself.

        --
        Jon Skeet - <skeet@pobox.co m>
        http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
        If replying to the group, please do not mail me too

        Comment

        Working...