「Groovy」<<=符号で文字列の末尾に文字列を追加する
書式
変数名 <<= 文字列
使用例
class SampleArk {
static void main(String[] args) {
String strA = "study"
//文字列を追加
strA <<= " skill "
strA <<= " in "
strA <<= " arkgame "
println "文字列の値"
println strA
println "文字列のクラスの型"
println strA.class
}
}
class SampleArk {
static void main(String[] args) {
String strA = "study"
//文字列を追加
strA <<= " skill "
strA <<= " in "
strA <<= " arkgame "
println "文字列の値"
println strA
println "文字列のクラスの型"
println strA.class
}
}
class SampleArk { static void main(String[] args) { String strA = "study" //文字列を追加 strA <<= " skill " strA <<= " in " strA <<= " arkgame " println "文字列の値" println strA println "文字列のクラスの型" println strA.class } }
実行結果
文字列の値
study skill in arkgame
文字列のクラスの型
class java.lang.String