<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Hugo Borges</title>
    <description>The latest articles on DEV Community by Hugo Borges (@hugodupan).</description>
    <link>https://dev.to/hugodupan</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1820251%2F9a3f32d8-7bad-4f3a-ac89-bb4b36680d4a.jpg</url>
      <title>DEV Community: Hugo Borges</title>
      <link>https://dev.to/hugodupan</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/hugodupan"/>
    <language>en</language>
    <item>
      <title>Validação de Chassi (VIN) em C#</title>
      <dc:creator>Hugo Borges</dc:creator>
      <pubDate>Tue, 18 Feb 2025 23:29:35 +0000</pubDate>
      <link>https://dev.to/hugodupan/validacao-de-chassi-vin-em-c-539i</link>
      <guid>https://dev.to/hugodupan/validacao-de-chassi-vin-em-c-539i</guid>
      <description>&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;using System;
using System.Text.RegularExpressions;

public static class ChassiValidator
{
    // Método principal para validar o chassi (VIN)
    public static bool ValidarChassi(string chassi)
    {
        // 1 - Verifica se o chassi começa com "0"
        if (Regex.IsMatch(chassi, @"^0", RegexOptions.IgnoreCase))
        {
            return false;
        }

        // 2 - Remove espaços do chassi
        chassi = chassi.Replace(" ", "");

        // 3 - Verifica se há repetição consecutiva de mais de 6 vezes a partir do 4º dígito
        if (Regex.IsMatch(chassi, @"^.{3,}([0-9A-Za-z])\1{5,}", RegexOptions.IgnoreCase))
        {
            return false;
        }

        // 4 - Verifica se o chassi contém os caracteres proibidos: i, I, o, O, q, Q
        if (Regex.IsMatch(chassi, @"[iIoOqQ]", RegexOptions.IgnoreCase))
        {
            return false;
        }

        // 5 - Verifica se os quatro últimos caracteres são numéricos
        if (!Regex.IsMatch(chassi, @"[0-9]{4}$", RegexOptions.IgnoreCase))
        {
            return false;
        }

        // 6 - Verifica se o chassi tem exatamente 17 caracteres
        if (chassi.Length != 17)
        {
            return false;
        }

        // Se todas as verificações passaram, o chassi é válido
        return true;
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>csharp</category>
      <category>vin</category>
      <category>chassi</category>
      <category>validation</category>
    </item>
  </channel>
</rss>
