Question: i have to split a string based on backslash separator
i have the following value

```
value=Alex\\patricia

```

and the value in the middle sometimes is valued ,but in this case does not have a value ,it s ignored by java
instead of having three tokens ,i have only two .

```
String[] tokens = StringUtils.split(value, '\\');

```

so i get

```
tokens[0]=Alex
tokens[1]=Alex=patricia

```

thanks

Answer: 
Try just using standard java classes

```
    String value="Alex\\patricia";
    String[] tokens = value.split("\\\\");
    for (String str : tokens) System.out.println(str);

```

**output**

```
Alex
patricia

```
That's how [`split`](http://commons.apache.org/proper/commons-lang/apidocs/org/apache/commons/lang3/StringUtils.html#split-java.lang.String-char-) from `StringUtils` works

> 
> Adjacent separators are treated as one separator
> 
> 
> 

You can use Java's `String` [`split`](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/String.html#split(java.lang.String)) instead.

```
String value = "Alex\\\\patricia";
String[] tokens = value.split("\\\\"); // must be escaped since it's a regex

```

Example jshell session:

```
jshell> String value="Alex\\\\patricia";
value ==> "Alex\\\\patricia"

jshell> String[] tokens = value.split("\\\\");
tokens ==> String[3] { "Alex", "", "patricia" }

```