/// <summary>
/// Obtenha o IP do usuário do site
/// </summary>
/// <Trackns> </lorpns>
public static string getUserip ()
{
retornar httpcontext.current.request.servervariables ["remote_addr"]. tostring ();
}
/// <summary>
/// Remova o último ',' Número da string
/// </summary>
/// <param name = "chr">: string a ser processada </amon>
/// <lorpns> retorna string processada </lortns>
Public Static String Lost (String Chr)
{
if (chr == null || chr == string.empty)
{
retornar "";
}
outro
{
Chr = Ch.Remove (Chr.LastIndexOF (","));
retornar chr;
}
}
/// <summary>
/// Remova o primeiro número '/' da string
/// </summary>
/// <param name = "chr"> string a ser processado </amon>
/// <lorpns> retorna string processada </lortns>
Public Static String LostFirst (String Chr)
{
string flg = "";
if (chr! = string.empty || chr! = null)
{
if (chr.substring (0, 1) == "/")
Flg = Ch.Replace (Chr.Substring (0, 1), "");
outro
flg = chr;
}
retornar FLG;
}
/// <summary>
/// Substitua caracteres especiais em html
/// </summary>
/// <param name = "thestring"> texto que precisa ser substituído. </param>
/// <Trackns> Texto substituído. </retornos>
Public Static String htmlencode (string theString)
{
thestring = theString.replace (">", ">");
thestring = theString.replace ("<", "<");
thestring = theString.replace ("", "");
thestring = theString.replace ("", "");
thestring = theString.replace ("/" "," "");
thestring = theString.replace ("/'", "'");
thestring = theString.Replace ("/n", "<br/>");
retornar o estrondo;
}
/// <summary>
/// restaurar caracteres especiais em html
/// </summary>
/// <param name = "thestring"> texto que precisa ser restaurado. </param>
/// <Returns> restaure um bom texto. </retornos>
Public Static String htmldiscode (string theString)
{
thestring = theString.replace (">", ">");
thestring = theString.replace ("<", "<");
thestring = theString.replace ("", "");
thestring = theString.replace ("", "");
thestring = theString.replace ("" ","/"");
thestring = theString.replace ("'", "/'");
thestring = theString.replace ("<br/>", "/n");
retornar o estrondo;
}
/// <summary>
/// gerar números aleatórios
/// </summary>
/// <param name = "length"> gerar comprimento </amon>
/// <Trackns> </lorpns>
Número de sequência estática pública (comprimento int)
{
número de retorno (comprimento, falso);
}
/// <summary>
/// gerar números aleatórios
/// </summary>
/// <param name = "length"> gerar comprimento </amon>
/// <param name = "Sleep"> se deve bloquear o segmento atual antes da geração para evitar a duplicação </amul>
/// <Trackns> </lorpns>
Número de cordas estáticas públicas (comprimento int, sono bool)