Utilizando RegEx em vez de startsWith

Utilizando RegEx em vez de startsWith








Segue um exemplo utilizando o regex em vez de startsWith


package br.com.tclsoftware.expreg;

import static java.lang.System.out;

public final class TCLExpReg {


  // Utiliza o startsWith
  protected final static String verificaChapa(String chapa) {

    // retira o caracter hiffen
    final String s = chapa.replaceAll("-", "");

    if(s.startsWith("10") || s.startsWith("11") ||" [...] continue lendo...

Artigos relacionados