[英]Is there a multi-line string syntax in Netlogo?
在 Python 中,有一種方法可以將長的多行文本存儲到變量中,如下所示:
a_string = """
This is a very long string
that spans multiple lines
and I do not need to worry about
line breaks
"""
我的問題:在NetLogo中是否有類似的東西,我可以將一段文本裝入特殊字符並存儲到一個變量中? 任何替代方法(例如字符串連接)也可以使用,如下所示:
a_string = "This is a very long string"
+ "and I might need to use some regexes"
+ "to get it into this format\n"
+ "as long as it's possible to do so."
到目前為止,我找不到任何類似前一個例子的東西,也沒有真正搜索過后者,因為前者是我的偏好,但我會很感激任何其他選擇。
原語這個word
應該可以做你想做的事。 只需確保用括號將其括起來即可處理多個值。 例子:
to set-a-string
let a_string (word "This is a very long string"
"and I might need to use some regexes"
"to get it into this format\n"
"as long as it's possible to do so.")
end
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.