jcomplex JComplex::parse(JString s) { jcomplex c; int p1 = s.indexOf(','); if (p1 == -1) { c.r = JDouble::parse(s); return c; } c.r = JDouble::parse(s(0, p1)); int p2 = s.indexOf('i'); if (p2 == -1) return c; c.i = JDouble::parse(s(p1+1, p2)); return c; }