How to get string parts from string?
I used to have my own String class with a member method called Chomp which did exactly what you are requiring.  The body was something similar to this untested code:

String chomp(String&amp; pSrc, char pMatch)
{
    int matchPos = pSrc.indexOf(pMatch);    // Find the first occurrence of the separator
    if (matchPos &lt; 0)   // Separator was not found.
    {
        String ret = pSrc;  // Return the remainder of the source string.
        pSrc = "";          // Clear the source string
        return ret;
    }

    String ret = pSrc.substring(0, matchPos - 1);   // "Chomp" the start of the string up to the separator into the return value
    pSrc.remove(0, matchPos);                       // Remove everything up to and including the separator.
    return ret;
}


Hopefully the above code should be pretty understandable and fixable if there are any errors.  Our version worked on a "this" pointer rather than passing in the source string, so we would have something like:

String sourceCoords = "12,47,292,85";
int x1 = sourceCoords.chomp(",").toInt();
int y1 = sourceCoords.chomp(",").toInt();
int x2 = sourceCoords.chomp(",").toInt();
int y2 = sourceCoords.chomp(",").toInt();


Hope this is of some use.