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
Post a Comment