|
Oktatás * Programozás 2 * Szkriptnyelvek * Adator. prog. Teaching * Prog. for Data Sci. Félévek Linkek * kalendárium |
Scala /
stringbuffer
The general concept is called stringbuffer. For this we will use the StringBuilder class.
scala> val b = new StringBuilder // empty stringbuffer
b: StringBuilder =
scala> b += 'L'
res22: b.type = L
scala> b += "aci"
<console>:9: error: type mismatch;
found : String("aci")
required: Char
b += "aci"
^
scala> b ++= "aci" // "aci" is a collection of chars, that's why ++= is needed
res24: b.type = Laci
scala> b.toString
res25: String = Laci
|
![]() Blogjaim, hobbi projektjeim * The Ubuntu Incident [ edit ] |