0
Today I use SMS sending system for our customers who are registered on Tiny ERP
, but I am in need of a mobile validator to be able to send scheduled SMS that are saved in a local bank.
The problem is that the system accepts to record wrong or fixed numbers.
I saw on the forum a validator made on c#
, but I can’t perform very well.
Follow the section of the validator:
if (!String.IsNullOrEmpty(cliente.contatos[0].celularddd) && !String.IsNullOrEmpty(cliente.contatos[0].celularnumero))
{
var celular = "55" + cliente.contatos[0].celularddd + cliente.contatos[0].celularnumero;
celular = celular.Replace(" ", String.Empty);//quando vem nesse parâmetro o valor do celular = "5515999999999"
if ( Convert.ToInt32(celular.Substring(5)) == 9)
{
log.celular_cliente = celular;
When the system arrives in the if ( Convert.ToInt32(celular.Substring(5)) == 9)
he does not recognize the number 9 and does not continue the process.
I get it, there’s a validator I can use?
– Wesley Henrique
You can use regex, you know the numbering rules?
– Jorge Costa
Ah yes, I’ll test the regex, thank you
– Wesley Henrique
Have an example? because it comes from an Api
– Wesley Henrique
Show an example of a number in your country and explain its composition
– Jorge Costa
No Brasil o celular (12)34567-8910, however for sending has the country code that is 55, except that in the case the string comes "5512345678910" and I need the fifth number to be 9
– Wesley Henrique