Ola Pessoal.

Estou com dificuldades para fazer as seguintes conversoes:

String a deve converter para Int

String b deve converter para Byte.

{

String CMDRead[10];//String d 10 caracteres q contem Letras e numeros

String a = CMDRead.substring(4,7);  //String d 3 caracteres q contem sempre um numero entre 0 e 255

String b = CMDRead.substring(7,10);//String d 3 caracteres q contem sempre um numero entre 0 e 255

}

Exibições: 3159

Responder esta

Respostas a este tópico

RESOLVIDO!!!

Creditos: JONATAS

//getInt Class

int getInt(String texto) // converte uma string em inteiro
{
int temp = texto.length() + 1;
char buffer[temp];
texto.toCharArray(buffer, temp);
int num = atoi(buffer);
return num;
}

Bom, sou novo aqui, mas já que demorei um pouco até encontrar a resposta,

Acho que o mais fácil é:

byte byteVar = byte(stringVar.toInt());

int aByte = a.toInt();

byte bByte = byte(a.toInt());

RSS

© 2024   Criado por Marcelo Rodrigues.   Ativado por

Badges  |  Relatar um incidente  |  Termos de serviço