replacing strange quote with standard quote

Discussion in 'ASP .Net' started by Stimp, Sep 19, 2006.

  1. Stimp

    Stimp Guest

    I have a function to replace the strange quotes (Chr(8220) and
    Chr(8221)) with standard quotes...

    e.g. Public Shared Function TextFormat(ByVal InputString As String) As
    String

    InputString = InputString.Replace(Chr(8220), """")
    InputString = InputString.Replace(Chr(8221), """")

    TextFormat = InputString
    End Function

    usage: TextFormat(objRS("Description"))


    This compiles fine, but when I run the page I get the following error:

    Procedure call or argument is not valid

    Line 340: InputString = InputString.Replace(Chr(8220), """")



    Any ideas?

    Thanks,
    Peter
     
    Stimp, Sep 19, 2006
    #1
    1. Advertising

  2. Try to use ChrW function instead.
    ChrW takes CharCode as a Unicode code point

    Public Shared Function TextFormat(ByVal InputString As String) As String


    InputString = InputString.Replace(ChrW(8220), """")
    InputString = InputString.Replace(ChrW(8221), """")

    TextFormat = InputString
    End Function
    --
    Programmer


    "Stimp" wrote:

    > I have a function to replace the strange quotes (Chr(8220) and
    > Chr(8221)) with standard quotes...
    >
    > e.g. Public Shared Function TextFormat(ByVal InputString As String) As
    > String
    >
    > InputString = InputString.Replace(Chr(8220), """")
    > InputString = InputString.Replace(Chr(8221), """")
    >
    > TextFormat = InputString
    > End Function
    >
    > usage: TextFormat(objRS("Description"))
    >
    >
    > This compiles fine, but when I run the page I get the following error:
    >
    > Procedure call or argument is not valid
    >
    > Line 340: InputString = InputString.Replace(Chr(8220), """")
    >
    >
    >
    > Any ideas?
    >
    > Thanks,
    > Peter
    >
     
    =?Utf-8?B?U2VyZ2V5IFp1eWV2?=, Sep 19, 2006
    #2
    1. Advertising

  3. Stimp

    Stimp Guest

    On Tue, 19 Sep 2006 Sergey Zuyev <> wrote:
    > Try to use ChrW function instead.
    > ChrW takes CharCode as a Unicode code point
    >
    > Public Shared Function TextFormat(ByVal InputString As String) As String
    >
    >
    > InputString = InputString.Replace(ChrW(8220), """")
    > InputString = InputString.Replace(ChrW(8221), """")
    >
    > TextFormat = InputString
    > End Function



    worked a treat... thanks a million!
    --

    fiddlewidawiddum
     
    Stimp, Sep 20, 2006
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    3
    Views:
    13,433
  2. Eric Layman
    Replies:
    3
    Views:
    665
    Rad [Visual C# MVP]
    Apr 14, 2007
  3. Choi
    Replies:
    10
    Views:
    562
    James Kanze
    Nov 29, 2007
  4. Replies:
    6
    Views:
    462
    Stefan Ram
    Jun 15, 2008
  5. Rob Meade

    Replacing - and not Replacing...

    Rob Meade, Apr 5, 2005, in forum: ASP General
    Replies:
    5
    Views:
    316
    Chris Hohmann
    Apr 11, 2005
Loading...

Share This Page