2

このフォームに入力しました

test@test.com

および/またはこの形式で

test@test.com;test2@test.com

また

test@test.com;test2@test.com;test3@test.com

区切り文字なしでセルごとに1つの電子メールのみを含む文字列配列ですべてをトークン化する必要があります

;
4

1 に答える 1

3

トークン化する必要はありません。次を使用してsplitください。

String[] emails = { "test@test.com;test2@test.com;test3@test.com", "test@test.com"  };
List<string> result = new ArrayList<String>();

for ( string listOfEmails : emails ) {
  for( string email : listOfEmails.split(";") ) {
    result.Add(email).
  }
}

System.out.println(result);

そして、それはすべての場合に機能します。

于 2012-10-01T11:35:34.657 に答える