function to string processing
Posted: 20 Feb 2012 12:07
Hi all,
I have developed this funcion at topmost level to help with string processing
and this is how is to be used:
this allow us to make something like this in a button:
I have developed this funcion at topmost level to help with string processing
Code: Select all
name: converteHex
parameter: car
decl val=car;
if(car == '0') val = 0x30;
if(car == 0) val = 0x30;
else if(car == '\') val = 0x5C;
else if(car == '/') val = 0x2F;
else if(car == '1') val = 0x31;
else if(car == '2') val = 0x32;
else if(car == '3') val = 0x33;
else if(car == '4') val = 0x34;
else if(car == '5') val = 0x35;
else if(car == '6') val = 0x36;
else if(car == '7') val = 0x37;
else if(car == '8') val = 0x38;
else if(car == '9') val = 0x39;
else if(car == 1) val = 0x31;
else if(car == 2) val = 0x32;
else if(car == 3) val = 0x33;
else if(car == 4) val = 0x34;
else if(car == 5) val = 0x35;
else if(car == 6) val = 0x36;
else if(car == 7) val = 0x37;
else if(car == 8) val = 0x38;
else if(car == 9) val = 0x39;
else if(car == 'a') val = 0x61;
else if(car == 'b') val = 0x62;
else if(car == 'c') val = 0x63;
else if(car == 'd') val = 0x64;
else if(car == 'e') val = 0x65;
else if(car == 'f') val = 0x66;
else if(car == 'g') val = 0x67;
else if(car == 'h') val = 0x68;
else if(car == 'i') val = 0x69;
else if(car == 'j') val = 0x6A;
else if(car == 'k') val = 0x6B;
else if(car == 'l') val = 0x6C;
else if(car == 'm') val = 0x6D;
else if(car == 'n') val = 0x6E;
else if(car == 'o') val = 0x6F;
else if(car == 'p') val = 0x70;
else if(car == 'q') val = 0x71;
else if(car == 'r') val = 0x72;
else if(car == 's') val = 0x73;
else if(car == 't') val = 0x74;
else if(car == 'u') val = 0x75;
else if(car == 'v') val = 0x76;
else if(car == 'w') val = 0x77;
else if(car == 'x') val = 0x78;
else if(car == 'y') val = 0x79;
else if(car == 'z') val = 0x7A;
else if(car == 'A') val = 0x41;
else if(car == 'B') val = 0x42;
else if(car == 'C') val = 0x43;
else if(car == 'D') val = 0x44;
else if(car == 'E') val = 0x45;
else if(car == 'F') val = 0x46;
else if(car == 'G') val = 0x47;
else if(car == 'H') val = 0x48;
else if(car == 'I') val = 0x49;
else if(car == 'J') val = 0x4A;
else if(car == 'K') val = 0x4B;
else if(car == 'L') val = 0x4C;
else if(car == 'M') val = 0x4D;
else if(car == 'N') val = 0x4E;
else if(car == 'O') val = 0x4F;
else if(car == 'P') val = 0x50;
else if(car == 'Q') val = 0x51;
else if(car == 'R') val = 0x52;
else if(car == 'S') val = 0x53;
else if(car == 'T') val = 0x54;
else if(car == 'U') val = 0x55;
else if(car == 'V') val = 0x56;
else if(car == 'W') val = 0x57;
else if(car == 'X') val = 0x58;
else if(car == 'Y') val = 0x59;
else if(car == 'Z') val = 0x5A;
return val;
Code: Select all
name: joinChars
parameters: array
// array is come vector like {'/','l','a','y','e','r',1,'/','c','l','i','p',1,'/','c','o','n','n','e','c','t'};
decl saida,i,size,arraySaida;
size = sizeof(array);
arraySaida=stretch(0,size);
for (i=0;i<size;i++)
{
arraySaida[i] = converteHex(array[i]);
}
saida = arraytostring(arraySaida);
return saida;
Code: Select all
decl clicado = firstof(x)+1;
decl endOSC = {'/','l','a','y','e','r',1,'/','c','l','i','p',1,'/','c','o','n','n','e','c','t'};
decl layer = 1;
decl definicaoDeClip = 12;
decl definicaoDeLayer = 6;
endOSC[definicaoDeClip] = clicado;
endOSC[definicaoDeLayer] = layer;
endereco = joinChars(endOSC);
oscout(0,endereco,1);