Replace Function

Discussion in 'ASP General' started by Steven Burn, Jan 21, 2004.

  1. Steven Burn

    Steven Burn Guest

    Replace(Data, Chr(34), Chr(34) & Chr(34))

    --
    Regards

    Steven Burn
    Ur I.T. Mate Group
    www.it-mate.co.uk

    Keeping it FREE!

    Disclaimer:
    I know I'm probably wrong, I just like taking part ;o)


    JT <> wrote in message
    news:...
    > how can i replace all single quotes in a string to double quotes:
    >
    > Replace(strLog_text, "'", """)
    >
    > however, this doesn't work, as you might expect.
    >
    > any ideas??
    >
    >
     
    Steven Burn, Jan 21, 2004
    #1
    1. Advertising

  2. Steven Burn

    Ray at Guest

    YourString = Replace(YourString, "'", """")
    'or
    theNewString = Replace(YourString, "'", """")

    To "escape" a " character in a string, you put it twice, "".

    Mind if I ask why you're replacing ' with " though?

    Ray at work

    "JT" <> wrote in message
    news:...
    > how can i replace all single quotes in a string to double quotes:
    >
    > Replace(strLog_text, "'", """)
    >
    > however, this doesn't work, as you might expect.
    >
    > any ideas??
    >
    >
     
    Ray at, Jan 21, 2004
    #2
    1. Advertising

  3. Steven Burn

    JT Guest

    how can i replace all single quotes in a string to double quotes:

    Replace(strLog_text, "'", """)

    however, this doesn't work, as you might expect.

    any ideas??
     
    JT, Jan 21, 2004
    #3
  4. Steven Burn

    Steven Burn Guest

    Woops.. sorry, just realised you meant ' and not ", lol

    Replace(data, Chr(39), Chr(34) & Chr(34))

    --
    Regards

    Steven Burn
    Ur I.T. Mate Group
    www.it-mate.co.uk

    Keeping it FREE!

    Disclaimer:
    I know I'm probably wrong, I just like taking part ;o)


    Steven Burn <nobody@PVT_it-mate.co.uk> wrote in message
    news:...
    > Replace(Data, Chr(34), Chr(34) & Chr(34))
    >
    > --
    > Regards
    >
    > Steven Burn
    > Ur I.T. Mate Group
    > www.it-mate.co.uk
    >
    > Keeping it FREE!
    >
    > Disclaimer:
    > I know I'm probably wrong, I just like taking part ;o)
    >
    >
    > JT <> wrote in message
    > news:...
    > > how can i replace all single quotes in a string to double quotes:
    > >
    > > Replace(strLog_text, "'", """)
    > >
    > > however, this doesn't work, as you might expect.
    > >
    > > any ideas??
    > >
    > >

    >
    >
     
    Steven Burn, Jan 21, 2004
    #4
  5. > how can i replace all single quotes in a string to double quotes:

    Why would you want to do that? Does O'Brien want to change his name to
    O"Brien?

    strLog_text = Replace(strLog_text, "'", CHR(34))
    or
    strLog_text = Replace(strLog_text, "'", """")

    --
    Aaron Bertrand
    SQL Server MVP
    http://www.aspfaq.com/
     
    Aaron Bertrand - MVP, Jan 21, 2004
    #5
  6. Steven Burn

    Steven Burn Guest

    I've done it again........ there's only meant to be one Chr(34)...... not
    two :eek:\

    --
    Regards

    Steven Burn
    Ur I.T. Mate Group
    www.it-mate.co.uk

    Keeping it FREE!

    Disclaimer:
    I know I'm probably wrong, I just like taking part ;o)


    Steven Burn <nobody@PVT_it-mate.co.uk> wrote in message
    news:#...
    > Woops.. sorry, just realised you meant ' and not ", lol
    >
    > Replace(data, Chr(39), Chr(34) & Chr(34))
    >
    > --
    > Regards
    >
    > Steven Burn
    > Ur I.T. Mate Group
    > www.it-mate.co.uk
    >
    > Keeping it FREE!
    >
    > Disclaimer:
    > I know I'm probably wrong, I just like taking part ;o)
    >
    >
    > Steven Burn <nobody@PVT_it-mate.co.uk> wrote in message
    > news:...
    > > Replace(Data, Chr(34), Chr(34) & Chr(34))
    > >
    > > --
    > > Regards
    > >
    > > Steven Burn
    > > Ur I.T. Mate Group
    > > www.it-mate.co.uk
    > >
    > > Keeping it FREE!
    > >
    > > Disclaimer:
    > > I know I'm probably wrong, I just like taking part ;o)
    > >
    > >
    > > JT <> wrote in message
    > > news:...
    > > > how can i replace all single quotes in a string to double quotes:
    > > >
    > > > Replace(strLog_text, "'", """)
    > > >
    > > > however, this doesn't work, as you might expect.
    > > >
    > > > any ideas??
    > > >
    > > >

    > >
    > >

    >
    >
     
    Steven Burn, Jan 21, 2004
    #6
  7. Steven Burn

    Guest

    Replace(strLog_text, "'", """")

    **********************************************************************
    Sent via Fuzzy Software @ http://www.fuzzysoftware.com/
    Comprehensive, categorised, searchable collection of links to ASP & ASP.NET resources...
     
    , Jan 23, 2004
    #7
    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. Brian Blais
    Replies:
    1
    Views:
    395
    Bruno Desthuilliers
    Jun 27, 2006
  2. Greg Ewing
    Replies:
    2
    Views:
    357
    Dieter Maurer
    Jun 29, 2006
  3. Alun
    Replies:
    3
    Views:
    4,580
    Masudur
    Feb 18, 2008
  4. Prasad S
    Replies:
    2
    Views:
    245
    Dr John Stockton
    Aug 27, 2004
  5. V S Rawat
    Replies:
    5
    Views:
    319
    Richard Cornford
    Jul 3, 2007
Loading...

Share This Page