跳轉到內容

Rebol 程式設計/trim

來自華夏公益教科書,開放的書籍,開放的世界
TRIM series /head /tail /auto /lines /all /with str 

從字串中刪除空格。預設從頭和尾刪除。

TRIM 是一個動作值。

  • series -- (型別:系列埠)
  • /head -- 僅從頭部刪除。
  • /tail -- 僅從尾部刪除。
  • /auto -- 自動縮排相對於第一行的行。
  • /lines -- 刪除所有換行符和多餘的空格。
  • /all -- 刪除所有空格。
  • /with
    • str -- 與 /all 相同,但刪除 'str' 中的字元。(型別:字元字串)

原始碼

[編輯 | 編輯原始碼]
trim: native[
    {Removes whitespace from a string. Default removes from head and tail.} 
    series [series! port!] 
    /head "Removes only from the head." 
    /tail "Removes only from the tail." 
    /auto "Auto indents lines relative to first line." 
    /lines "Removes all line breaks and extra spaces." 
    /all "Removes all whitespace." 
    /with str [char! string!] "Same as /all, but removes characters in 'str'."
]
華夏公益教科書