static public String munge(String s){
  s=s.replaceAll("%"," Percent ");
  s=s.trim();
  s=s.replaceAll("[^(\\w|\\.|\\-)]","_");
  return s;
}

static public String munge ( String s ) { s = s . replaceAll ( "%" , " Percent " ) ; s = s . trim ( ) ; s = s . replaceAll ( "[^(\\w|\\.|\\-)]" , "_" ) ; return s ; }
munge a metric name so that it is suitable for use in a filesystem ( ganglia stores metric names and host names in the file system but does not munge them well itself ) . in particular , any non - word characters ( other than ' . ' , ' - ' and similar things which are legal in file names ) are converted to an underscore character ( " _ " ) . this gets rid of all punctuation characters and whitespace in the metric name itself , but will not translate unicode characters .
