Anonymous user
Tokenize a string: Difference between revisions
→{{header|Java}}: Added a java 8 version
(added Elixir) |
(→{{header|Java}}: Added a java 8 version) |
||
Line 842:
The first is by splitting the String into an array of Strings. The separator is actually a regular expression so you could do very powerful things with this, but make sure to escape any characters with special meaning in regex.
{{works with|Java|1.8+}}
<lang java5>String toTokenize = "Hello,How,Are,You,Today";
System.out.println(String.join(".", toTokenize.split(",")));</lang>
{{works with|Java|1.4+}}
|