Ask a Question
Ask Question Login
Corporate Training
  1. Community
  2. Java
  3. Question
Java

Use String.split() with multiple delimiters

Asked by Aashna Saito Jun 22, 2021 695 views 1 answer
Share

About this question

I need to split a string base on delimiter - and .. Below are my desired output.

AA.BB-CC-DD.zip ->
AA
BB
CC
DD
zip 

but my following code does not work.

private void getId(String pdfName){
    String[]tokens = pdfName.split("-\.");
}

Your answer

1 Answer

More Java discussions

Learn & Explore

Free tutorials and interview questions from industry experts — learn the skill, then get ready to prove it.

Latest Java Blogs

Guides, tips and career advice on Java from JanBask experts.