Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

162
Visualizações
El método de descifrado JS se traduce a C#

Necesito ayuda con la traducción del código JS a C#. Código JS:

 function Decription(string) { var newString = '', char, codeStr, firstCharCode, lastCharCode; var ft = escape(string); string = decodeURIComponent(ft); for (var i = 0; i < string.length; i++) { char = string.charCodeAt(i); if (char > 132) { codeStr = char.toString(10); firstCharCode = parseInt(codeStr.substring(0, codeStr.length - 2), 10); lastCharCode = parseInt(codeStr.substring(codeStr.length - 2, codeStr.length), 10) + 31; newString += String.fromCharCode(firstCharCode) + String.fromCharCode(lastCharCode); } else { newString += string.charAt(i); } } return newString; }

Y até para traducir en C#:

 private string Decription(string encriptedText) { string ft = Regex.Escape(encriptedText); string text = HttpUtility.UrlDecode(ft); string newString = ""; for (int i = 0; i < text.Length; i++) { var ch = (int)text[i]; if(ch > 132) { var codeStr = Convert.ToString(ch, 10); var firstCharCode = Convert.ToInt32(codeStr.Substring(0, codeStr.Length - 2), 10); var lastCharCode = Convert.ToInt32(codeStr.Substring(codeStr.Length - 2, codeStr.Length), 10) + 31; } } }

Pero cómo puedo traducir esta fila:

 newString += String.fromCharCode(firstCharCode) + String.fromCharCode(lastCharCode);

¿Quizás conoce el método equivalente a String.fromCharCode() en C#?

over 4 years ago · Santiago Trujillo
2 Respostas
Responde à pergunta

0

Aquí tienes:

 public static void Main() { // from 97 to a int i = 97; Console.WriteLine(StringFromCharCode(97)); } public static string StringFromCharCode(int code) => ((char)code).ToString();

Manifestación

Tenga en cuenta que es posible que desee utilizar un StringBuilder en lugar de concatenar string en su caso.

Relacionado con Int to Char en C# (Léalo. Incluye un buen comentario sobre cast vs Convert.ToChar )

over 4 years ago · Santiago Trujillo Relatório

0

Simplemente puede usar el método Convert.ToChar , Convert.ToChar(97) devolverá a archivo .

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda