I'm trying to iterate on a String value to change each occurence of it. For example i want that "1" become "one", "2" become "two", etc.
I've done this :
override def toString = {
val mapXX = init.map(_.clone);
var returnVALUE = mapXX.map(_.mkString).mkString("\n")
for(c <- returnVALUE){
c match {
case 1 => "one";
case 2 => "two";
...
case _ => "";
}
}
returnVALUE
}
}
It didn't change anything of my list, i have the same display of my list. Nothing has changed.
Did someone knows how can we iterate on each character of a String value in order to replace each character by something else ?
Thanks
Aucun commentaire:
Enregistrer un commentaire