将字符串转换为Arraylist

时间:2014-01-12 14:51:29

标签: java android

我有一个大文本文件,我想把它放到ArrayList中。我的文本文件在开始时包含#符号,这里是文本文件数据。

  #These classes define the style and structure for your dialog, but you should use a DialogFragment as a container for your dialog. The DialogFragment class provides all the controls you need to create your dialog and manage its appearance, instead of calling methods on the Dialog object.
  #These classes define the style and structure for your dialog, but you should use a DialogFragment as a container for your dialog. The DialogFragment class provides all the controls you need to create your dialog and manage its appearance, instead of calling methods on the Dialog object.
  #These classes define the style and structure for your dialog, but you should use a DialogFragment as a container for your dialog. The DialogFragment class provides all the controls you need to create your dialog and manage its appearance, instead of calling methods on the Dialog object.

1 个答案:

答案 0 :(得分:1)

您可以使用以下代码分割字符串

String[] divide = string.split("#");

然后你可以使用

List<String> stringList = new ArrayList<String>(Arrays.asList(divide)); 

这会将String数组转换为ArrayList。

相关问题