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

c - Mpirun hangs when mpi send and recieve is put in a loop -

python - Apply coupon to a customer's subscription based on non-stripe related actions on the site -

java - Unable to get JDBC connection in Spring application to MySQL -