Validation of module 11

Dear,

I need to validate the RUT (Chile), which is based on Module 11.

There is some way to perform this validation.

Thank you.

Greetings.

Dear Franco,

Please provide any substantive details to help you with your problem:

  1. The questionnaire.
  2. The question you want to validate.
  3. The validation rule you are trying to implement.

Make sure you are familiar with Syntax Guide section on our support page: https://support.mysurvey.solutions/syntax-guide.

1 Like

Hola Franco,

Para el caso de Chile, a mí me funcionó este código:

String.Concat(“0K987654321” [(int) Enumerable.Range (0, (int) rutenc.Length - 1)
.Select (i =>
((i % 6) + 2) *
((long.Parse(rutenc.Left(rutenc.Length-1))/ (int) Math.Pow (10, i)) % 10))
.Sum () % 11]).ToUpper()==rutenc.Right(1).ToUpper()

Donde, rutenc es del tipo string “12345678k” o “12345678K”
Es una adaptación desde https://es.wikipedia.org/wiki/Anexo:Implementaciones_para_algoritmo_de_rut#C#

Ruego responder en caso de encontrar error o versión más optimizada.

Saludos,
Felipe Pizarro