Java - How to identify what is the most frequently used delimiter -


I have a string:

www.domain.com/I- sure-this-part

I have to find out what happens after the most used delimiter in this case - - The delimiter can change on the basis of the URL.

Once I work on it, then in the most frequently used delimiter I can count the parts. Split and pass Will use.

It will be highly appreciated.

Thank you in advance.

It should be a lot to calculate the characters considering the candidates for the delimiter For simple tasks you can employ indexOf for this.

  last string URL = "www.domain.com/I-sure-this-part"; Last integer required start = url.indexOf ('/') + 1; Variable most = '\ u0000'; Int highest = 0; (Four Delegates: new letter [] {'%', '-', '$', '+'}) {int cnt = 0; For (int i = url.indexOf (delim, needStart); i! = -1; i = url.indexOf (Delim, I + 1), CNT ++); If (CNT & gt; Highest Freak) {Highest Frack = CNT; Most = Delim; }} System.out.println (most frequent);    

Comments