arduino string to hex

thank you for pointing me into the right direction i got it all working

//Start Defining Tv Code
#define KEY_POWERON 0x750;
#define KEY_POWEROFF 0xF50;
#define KEY_TUNER 0x250;
#define KEY_VIDEO1 0x030;
#define KEY_VIDEO2 0x830;
#define KEY_VIDEO3 0x430;
#define KEY_VIDEO4 0xE30;
#define KEY_VIDEO5 0x130;
#define KEY_VIDEO6 0x930;
#define KEY_POWER 0xA90;
#define KEY_MUTE 0x290;
#define KEY_SLEEP 0x6D0;
#define KEY_ANTENNA 0x550;
#define KEY_DISPLAY 0x5D0;
#define KEY_INPUT 0xA50;
#define KEY_1 0x010;
#define KEY_2 0x810;
#define KEY_3 0x410;
#define KEY_4 0xC10;
#define KEY_5 0x210;
#define KEY_6 0xA10;
#define KEY_7 0x610;
#define KEY_8 0xE10;
#define KEY_9 0x110;
#define KEY_0 0x910;
#define KEY_JUMP 0xDD0;
#define KEY_ENTER 0xD10;
#define KEY_MENU 0x070;
#define KEY_UP 0x2F0;
#define KEY_DOWN 0xAF0;
#define KEY_LEFT 0x2D0;
#define KEY_RIGHT 0xCD0;
#define KEY_OK 0xA70;
#define KEY_VOLUMEUP 0x490; //varafied
#define KEY_VOLUMEDOWN 0xC90;
#define KEY_CHANNELUP 0x090;
#define KEY_CHANNELDOWN 0x890;
#define KEY_FREEZE 0x3B0;
#define KEY_PIP 0xDB0;
#define KEY_PICTUREMODE 0x270;
//End Defining Tv Code

#include <IRremote.h>
IRsend irsend;


// how much serial data we expect before a newline
const unsigned int MAX_INPUT = 50;

void setup ()
{
  Serial.begin(9600);   // Start Serial Port

  pinMode(4,OUTPUT);   // 
  digitalWrite(4,HIGH);// Turn Lights on through Relay
} // end of setup

// here to process incoming serial data after a terminator received
void process_data (char * data)
{
  // Start Send Tv Code
   int value = x2i(data);
    
    Serial.println(value);

  for (int i = 0; i < 2; i++) {
    irsend.sendSony(value, 12); // Sony TV code
    delay(100);
  }
  //End Tv Send Code
  
}  // end of process_data


void loop()
{
  static char input_line [MAX_INPUT];
  static unsigned int input_pos = 0;

  if (Serial.available () > 0) 
  {
    char inByte = Serial.read ();

    switch (inByte)
    {

    case '\n':   // end of text
      input_line [input_pos] = 0;  // terminating null byte

      // terminator reached! process input_line here ...
      process_data (input_line);

      // reset buffer for next time
      input_pos = 0;  
      break;

    case '\r':   // discard carriage return
      break;

    default:
      // keep adding if not full ... allow for terminating null byte
      if (input_pos < (MAX_INPUT - 1))
        input_line [input_pos++] = inByte;
      break;

    }  // end of switch

  }  // end of incoming data

  // do other stuff here like testing digital input (button presses) ...

}  // end of loop

//Start Hex String To Int
int x2i(char *s) 
{
  int x = 0;
  for(;;) {
    char c = *s;
    if (c >= '0' && c <= '9') {
      x *= 16;
      x += c - '0'; 
    }
    else if (c >= 'A' && c <= 'F') {
      x *= 16;
      x += (c - 'A') + 10; 
    }
    else break;
    s++;
  }
  return x;
}
//End Hex String To Int

//start debug 
void Debug(String Title, String Value){
  Serial.println();
  Serial.println("---start debug---");
  Serial.println(Title);
  Serial.println(Value);
  Serial.println("---end Debug---");

  //end debug
}