Thursday, 28 February 2013

Replace junk charater function

public string cleanip(string str)
    {
        string str_op;
        str_op = str;
        if (str_op != "" && str_op != null)
        {
            str_op = str_op.Replace("<", "");
            str_op = str_op.Replace(">", "");
            str_op = str_op.Replace("&lt;", "");
            str_op = str_op.Replace("&gt;", "");
        }
        if (str_op != null)
        {
            if (str_op.Length >= 50)
                str_op = str_op.Remove(50);
        }
        return str_op;
    }

No comments:

Post a Comment