Groovy - plus()



追加字串

語法

String plus(Object value) 

引數

Value - 要追加到字串的物件

返回值

此方法返回結果字串。

示例

以下是此方法用法示例 -

class Example { 
   static void main(String[] args) { 
      String a = "Hello";
		
      println(a.plus("World")); 
      println(a.plus("World Again")); 
   } 
}

執行以上程式時,我們將獲得以下結果 -

HelloWorld 
HelloWorld Again
groovy_strings.htm
廣告
© . All rights reserved.