Code example for StringTokenizer

Methods: countTokens, nextToken

0
     * ((37.34068368469045, -122.48519897460936), (37.72184917678752, -121.79855346679686)) 
     */ 
    public static GLatLngBounds parse(final String value) {
        StringTokenizer tokenizer;
        try { 
            tokenizer = new StringTokenizer(value, "(, )");
        } catch (final NullPointerException e) {
            return null; 
        } 
        if (tokenizer.countTokens() != 4) {
            return null; 
        } 
 
        final GLatLng sw = new GLatLng(Float.valueOf(tokenizer.nextToken()), Float.valueOf(tokenizer.nextToken()));
        final GLatLng ne = new GLatLng(Float.valueOf(tokenizer.nextToken()), Float.valueOf(tokenizer.nextToken()));
        return new GLatLngBounds(sw, ne);
    } 
 
    /** 
     * Workaround for http://code.google.com/p/gmaps-api-issues/issues/detail?id=3117. 
     * @param _getBounds