Substring problem

Hi,

I’m trying to extract and use the text content from an SMS, by removing all the header info before the message.

The SMS message is constructed like this:

+CMT: "+447777777777","","14/12/09,23:09:00+00"
Message text appears here

I place the whole message in a string called ‘inputString’. Then my code simply looks for the sixth set of double quotes and, using substring(), replaces the current string with everything in the string from the character after the sixth occurrence of the double quotes:

  int g = 0; // count the number of " found
  int f = 0; // count the number of characters
  
  while (g < 6) {
    
    if ((inputString.charAt(f) == '"') && (f < inputString.length())) {
      g++;
      f++;
    } else {
      f++;
    }
    
  }
  
  
  if (f < inputString.length()){
      inputString = inputString.substring(f+2, inputString.length());
  }

This works perfectly, unless the string is longer than approx. 160 characters, in which case the string seems to be being completely emptied.

Any ideas? Is the string simply getting too long for me to attempt to manipulate it in this way?

Use a char array, not a String :)