Question: need to separate the string,i need to separate it.The String is dynamically add.

For Example 

```
1.String a="C:\Wowza Media Systems\Wowza Media Server 2.2.3\content\user2\weight.mp4" 

```

i need to separate it **user2**

```
2. String a="C:users\Wowza Media Systems\Wowza Media Server 2.2.3\content\user2\sample.flv"

```

So i added the value dynamically for **a**, but i need to separate the string before **weight.mp4** after **content** .

Answer: 
You Can approach like also..

```
String s="C:/Wowza Media Systems/Wowza Media Server 2.2.3/content/user2/weight.mp4";
String strArray[]=s.split("/"); 
String fileName = strArray[strArray.length-1]; /*weight.mp4*/
int index = s.indexOf(fileName); 
String path = s.substring(0,index) /*C:/Wowza Media Systems/Wowza Media Server 2.2.3/content/user2/*/

```
If I understood you correctly you want to fetch the file name from that String. If so:

If you have your String a defined like this:

```
String a="C:\\Wowza Media Systems\\Wowza Media Server 2.2.3\\content\\user2\\weight.mp4"

```

try the code:

```
String[] split = a.split("\\");
String file = null;
if(split.length!=0) file=split[split.length-1];
System.out.println(file);

```