What is the equivalent of chr() in asp.net (csharp)?

Last post 06-11-2009 6:10 AM by naveenreddy.gopu. 5 replies.

Sort Posts:

  • What is the equivalent of chr() in asp.net (csharp)?

    04-18-2006, 11:15 AM
    • Member
      15 point Member
    • stl
    • Member since 03-15-2006, 5:59 AM
    • Posts 3

    I am migrating old asp code which contain chr(10).

    What is the equivalent function in csharp?

  • Re: What is the equivalent of chr() in asp.net (csharp)?

    04-18-2006, 1:16 PM
    • All-Star
      23,809 point All-Star
    • pkellner
    • Member since 11-12-2004, 10:42 AM
    • San Jose, California
    • Posts 3,573
    • ASPInsiders
      Moderator
      TrustedFriends-MVPs

    this is what I do for carriage returns.

    public static string crlf = "\r\n";

     

    Peter Kellner
    http://peterkellner.net
    Microsoft MVP • ASPInsider
  • Re: What is the equivalent of chr() in asp.net (csharp)?

    04-18-2006, 9:36 PM
    • Member
      15 point Member
    • stl
    • Member since 03-15-2006, 5:59 AM
    • Posts 3

    I need to know how to convert this code to csharp.

     

    'convert all types of single quotes
     tmpString = replace(tmpString, chr(145), chr(39))
     tmpString = replace(tmpString, chr(146), chr(39))
     tmpString = replace(tmpString, "'", "'")
     
     'convert all types of double quotes
     tmpString = replace(tmpString, chr(147), chr(34))
     tmpString = replace(tmpString, chr(148), chr(34))
    ' tmpString = replace(tmpString, """", "\""")
     
     'replace carriage returns & line feeds
     tmpString = replace(tmpString, chr(10), " ")
     tmpString = replace(tmpString, chr(13), " ")
  • Re: What is the equivalent of chr() in asp.net (csharp)?

    04-30-2006, 6:15 AM
    • Member
      165 point Member
    • spawned
    • Member since 10-05-2003, 3:52 AM
    • Melbourne, Australia
    • Posts 33

    The function below will work:

    private

    string RTESafe(string strText)

    {

    // returns safe code for preloading in the

    string rawString = strText.TrimEnd();

    rawString = rawString.Replace(Convert.ToChar(145), Convert.ToChar(39));

    rawString = rawString.Replace(Convert.ToChar(146), Convert.ToChar(39));

    rawString = rawString.Replace("'", "'");

    //convert all types of double quotes

    rawString = rawString.Replace(Convert.ToChar(147), Convert.ToChar(34));

    rawString = rawString.Replace(Convert.ToChar(148), Convert.ToChar(34));

    //replace carriage returns & line feeds

    rawString = rawString.Replace("\n", " ");

    rawString = rawString.Replace("\r", " ");

    return rawString;

     

    Regards,

    Shaun.

    www.infobytesmedia.com

     

  • Re: What is the equivalent of chr() in asp.net (csharp)?

    06-07-2009, 2:19 AM
    private string RTESafe(string strText)

    {

     

    // returns safe code for preloading in the

    string rawString = "";

    rawString = rawString + strText;

    rawString = rawString.Replace(
    Convert.ToChar(145), Convert.ToChar(39));

    rawString = rawString.Replace(Convert.ToChar(146), Convert.ToChar(39));

    rawString = rawString.Replace("'", "'");

     

    //convert all types of double quotes

    rawString = rawString.Replace(Convert.ToChar(147), Convert.ToChar(34));rawString = rawString.Replace(Convert.ToChar(148), Convert.ToChar(34));

     

    //replace carriage returns & line feeds

    rawString = rawString.Replace("\n", " ");rawString = rawString.Replace("\r", " ");

     

     

    return rawString;

    and How to call External *.js file in aspx.cs file, not to be call
    in aspx page like <src = *.js />
    i want in asp.cs only and
    how to handle form tags in Master page of child pages, because 
    child pages having only 
    "login" ContentPlaceHolderID="loginbuttons" runat="server">
    tags
    how handle form tags in this
     
  • Re: What is the equivalent of chr() in asp.net (csharp)?

    06-11-2009, 6:10 AM
    string rawString = "";

    rawString = rawString + strText;

    rawString = rawString.Replace(
    Convert.ToChar(145), Convert.ToChar(39));

    rawString = rawString.Replace(Convert.ToChar(146), Convert.ToChar(39));

    rawString = rawString.Replace("'", "&#39;");

     

    //convert all types of double quotes

    rawString = rawString.Replace(Convert.ToChar(147), Convert.ToChar(34));rawString = rawString.Replace(Convert.ToChar(148), Convert.ToChar(34));

     

    //replace carriage returns & line feeds

    rawString = rawString.Replace("\n", " ");

    rawString = rawString.Replace("\r", " ");

Page 1 of 1 (6 items)