java - How to replace space with hyphen? -


I want to change space with space

Suppose my code is

  stringbuff tokenr = new stringbuffer (); Tokenstr.append ("The technician education system of the Cabinet has approved the following");   

I want output

  "Technician-education-system-cabinet-approved-has the following"   < P> Thanks   

Like this,

  stringbuffer tokenstr = new stringbuffer (); Tokenstr.append ("The technician education system of the Cabinet has approved the following"); System.out.println (tokenstr.toString (). ReplaceAll ("", "-"));   

and also like this

  system.out.println (tokenstr.toString (). ReplaceAll ("\\ s +", "-" ));    

Comments

Popular posts from this blog

python - how we can use ajax() in views.py in django? -

matlab - Using loops to get multiple values into a cell -

python - Sequence Pattern recognition with Pybrain -