create unity3D custom mask

1

How do I create a date mask on the 3D unity platform, so that when I type it, it automatically places the "/" characters?

Example: 00/00/0000

    
asked by anonymous 26.02.2016 / 14:31

1 answer

2

Evandro does not know how you call a function using unity3D, but the function below does what you need.

function mdata(v) {
  v = v.replace(/\D/g, "");                    //Remove tudo o que não é dígito
  v = v.replace(/(\d{2})(\d)/, "$1/$2");
  v = v.replace(/(\d{2})(\d)/, "$1/$2");

  v = v.replace(/(\d{2})(\d{2})$/, "$1$2");
  return v;
}
    
26.02.2016 / 19:31