我想将def date= new Date()
转换为字符串,以便我可以创建此表达式def text=data+" "+"http://hjghjghj.ge(Service) /https:jsonparces getting data from taxservice:Successfully received response
然后使用文本作为字符串我尝试toString()但是它没有任何更好的想法?
答案 0 :(得分:0)
您甚至不需要toString()
,只需在字符串连接中使用它就可以转换它,但您必须使用String + Date
,而不是Date + String
,就像在Java中一样。所以要么使用
def text=""+date+" "+"http://hjghjghj.ge(Service) /https:jsonparces getting data from taxservice:Successfully received response
或
def text=(data as String)+" "+"http://hjghjghj.ge(Service) /https:jsonparces getting data from taxservice:Successfully received response
或
def text=data.toString()+" "+"http://hjghjghj.ge(Service) /https:jsonparces getting data from taxservice:Successfully received response`