You could do this:

String str = "...";
List<String> elephantList = Arrays.asList(str.split(","));

Basically the .split() method will split the string according to (in this case) delimiter you are passing and will return an array of strings.

However, you seem to be after a List of Strings rather than an array, so the array must be turned into a list by using the Arrays.asList() utility. Just as an FYI you could also do something like so:

String str = "...";
ArrayList<String> elephantList = (ArrayList<String>)Arrays.asList(str.split(","));

But it is usually better practice to program to an interface rather than to an actual concrete implementation, so I would recommend the 1st option.

JAVA - split: 将字符串分割成数组_wutangpuer的博客-CSDN博客_ ...

https://blog.csdn.net/wutangpuer/article/details/41442525

2014年11月24日 ... 利用split把字符串按照指定的分割符进行分割,然后返回字符串数组,下面是string. split的用法 ... 连字符,比如:String str="Java string-split#test",可以用Str.split(" |-|#") 把每个字符串分开; ... String类的split方法可以将字符串按照特定分隔符拆分成 字符串数组。 ... Java split 根据指定字符串分隔成list数组的用法.

How to Split String based on delimiter in Java ... - Javarevisited

https://javarevisited.blogspot.com/2017/01/how-to-split-string-based-on-delimiter-in-java.html

Jan 23, 2017 ... Splitting a String on delimiter as the pipe is a little bit tricky becuase the most obvious solution will not work, given pipe is a special character in Java regular expression. ... 3rd Example - splitting a comma-separated String.

Java 实例– 字符串分割| 菜鸟教程

https://www.runoob.com/java/string-split.html

Java 实例- 字符串分割Java 实例以下实例使用了split(string) 方法通过指定分隔符字符串分割为数组: JavaStringSplitEmp.java 文件[mycode3 type='java'] public ...

字符串分割--java中String.split()用法_kunlong0909的专栏-CSDN博客 ...

https://blog.csdn.net/kunlong0909/article/details/8507290

2013年1月15日 ... 把三个都分隔出来,可以用String.split("and|or"); 3、public String[] split(String regex,int limit)根据匹配给定的正则表达式来拆分此字符串

Java.String.split() | Baeldung

https://www.baeldung.com/string/split

3 days ago ... The method split() splits a String into multiple Strings given the delimiter that separates them. The returned object is an array which contains the ...

Java开发笔记(三十七)利用正则串分割字符串- pinlantu - 博客园

https://www.cnblogs.com/pinlantu/p/10125236.html

2018年12月15日 ... 分割规则通常是指定某个分隔符根据字符串内部的分隔符字符串进行分割, 例如逗号、空格等等都可以作为字符串分隔符。正好String类型 ...

字符串倒转,以空格为间隔_cczz598的专栏-CSDN博客

https://blog.csdn.net/cczz598/article/details/45194789

2015年4月22日 ... 很好理解,就是把字符串用 split(" +") 的方法拆开String数组,然后将这个数组倒序 拼接在一起。 ... 字符串以空格为分隔符,怎么将他们分开? 01-13 ... java字符串反 转,逆序输出(句子反转,单词不翻转). 01-14 ... 阿里巴巴的实习生笔试题,实现 将字符串特定分隔符进行反转,如“www.taobao.com”,反转后 ...

Java split 根据指定字符串分隔成list数组的用法- brightgreat - 博客园

https://www.cnblogs.com/brightgreat/p/10020725.html

2018年11月26日 ... 3、如果在一个字符串中有多个分隔符,可以用"|"作为连字符,比如:String str="Java string-split#test",可以用Str.split(" |-|#")把每个字符串分开;.

How to split a comma-separated string? - Stack Overflow

https://stackoverflow.com/questions/10631715/how-to-split-a-comma-separated-string

... .split() method will split the string according to (in this case) delimiter ... @ GurselKoca answer to Removing whitespace from strings in Java).

split() - Azure Data Explorer | Microsoft Docs

https://docs.microsoft.com/en-us/azure/data-explorer/kusto/query/splitfunction

Feb 13, 2020 ... Splits a given string according to a given delimiter and returns a string array with the contained substrings. Optionally, a specific substring can ...

Java的split方法使用多种分隔符切分字符串_u013732444的博客 ...

https://blog.csdn.net/u013732444/article/details/78112973

2017年9月27日 ... 多个分隔符使用'|'分开,例如:. String str = "abc ... 相关推荐. StringUtils 根据指定 的分隔符进行截取 ... java的split方法可以实现同时使用多个分隔符劈开字符串方法 : ... 需求说明: 1、在项目中需要对一个特定字符串进行分割,获取分隔后的 数据。 2、字符串 ... 重复使用的话就可以把字符串分割开了。关键字: ...

怎么样把一个字符串分割成单个字符数组?-CSDN论坛

https://bbs.csdn.net/topics/90482435

在Swift中,如果需要把一个字符串根据特定分隔符拆分(split)成字符串 ... java String中文字符串分割成一定长度的字符串数组/** * 几个字一组变量控制大于零有 ...

[Java] String.split()的用法- 知乎

https://zhuanlan.zhihu.com/p/45151144

2018年9月22日 ... 本文讨论Java中的split函数.split()是一个用来切分字符串的函数, 相信大家都用过, ... 最基本的用法当然就是用指定字符串直接分割代码, 一般来说是一个符号之类的, ... 如何获取一个句子中的所有单词(也就是以非单词作为分隔符) ?

把一个字符串按某字符(分隔符)分开,如何分最好?-CSDN论坛

https://bbs.csdn.net/topics/370021689

Java根据某一分隔符拆分字符串Java学习过程中常常需要根据某一特定分隔 来拆分字符串,这里演示一下: 例如:输入字符串2015-12-21需要根据“-”来拆 ...

java split string by length

https://greenvalleyintl.com/wp-content/baking-with-bekkhy/java-split-string-by-length-72c60c

Splitting a string delimited by pipe (|) is a little bit tricky. ... Variants and splits this string around matches of the given string according to the split size, examples ...

How to Split a String in Java with Delimiter - Javatpoint

https://www.javatpoint.com/how-to-split-a-string-in-java-with-delimiter

In Java, delimiters are the characters that split (separate) the string into tokens. Java allows ... It splits the string according to specified regular expression regex.

Split() String Method in Java: How to Split String with Example

https://www.guru99.com/how-to-split-a-string-in-java.html

Feb 19, 2021 ... The StrSplit() method splits a String into an array of substrings. ... method allows you to break a string based on specific Java string delimiter.

How to split a string in C/C++, Python and Java? - GeeksforGeeks

https://www.geeksforgeeks.org/how-to-split-a-string-in-cc-python-and-java/

Nov 25, 2020 ... Almost all programming languages, provide function split a string by some delimiter. In C/C++: // Splits str[] according to given delimiters.

Split string or character vector at specified delimiter - MATLAB strsplit

https://www.mathworks.com/help/matlab/ref/strsplit.html

C = strsplit( str , delimiter ) splits str at the delimiters specified by delimiter . If str has consecutive delimiters, with no other characters between them, then strsplit ...

Java split string - Java tokenize string examples - HowToDoInJava

https://howtodoinjava.com/java/string/4-ways-to-split-tokenize-strings-in-java/

Learn to split string into arraylist using single delimiter or multiple delimiters. Guava Splitter is ... Before using this data further, it must be splitted to separate string tokens. We will ... You need to do these specific handling token by token basis.