【问题标题】:How can I trim a string?如何修剪字符串?
【发布时间】:2022-06-22 00:40:27
【问题描述】:

假设我有以下string

(def introduction " Hello World ")

我尝试使用 string/strip,但它给了我一个错误:

(def trimed_introduction (string/strip introduction))
compile error: unknown symbol string/strip 
# Output: compile error: unknown symbol string/strip

【问题讨论】:

    标签: janet


    【解决方案1】:

    string/strip 不存在,你可以使用string/trim

    (def trimmed_introduction (string/strip introduction))
    trimmed_introduction # Output: "Hello World"
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2022-01-01
      • 2017-04-25
      • 2012-12-21
      • 2020-01-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-08-10
      相关资源
      最近更新 更多