public PersonName(String s) { if (s == null) s = string.Empty; int grLen = s.IndexOf((System.Char) '='); if ((grLen == - 1?s.Length:grLen) > 64) { throw new System.ArgumentException(s); } Tokenizer stk = new Tokenizer(s, "=^"); int field = FAMILY; String tk; while (stk.HasMoreTokens()) { tk = stk.NextToken(); switch (tk[0]) { case '^': if (++field > SUFFIX) throw new System.ArgumentException(s); break; case '=': goto WHILE_brk; default: components[field] = tk; break; } } WHILE_brk: ; if (!stk.HasMoreTokens()) return ; tk = stk.NextToken("="); if (tk[0] != '=') { ideographic = new PersonName(tk); if (stk.HasMoreTokens()) tk = stk.NextToken("="); } if (!stk.HasMoreTokens()) return ; tk = stk.NextToken(); if (tk[0] == '=' || stk.HasMoreTokens()) throw new System.ArgumentException(s); phonetic = new PersonName(tk); }
private String[] toStringArray(String s) { Tokenizer stk = new Tokenizer(s, " ,;[]\t\r\n"); if (!stk.HasMoreTokens()) { return null; } String[] array = new String[stk.Count]; for (int i = 0; i < array.Length; ++i) { array[i] = stk.NextToken(); } return array; }