<?xml version="1.0" encoding="utf-8"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"><channel><title>MagicLen</title><link>https://magiclen.org/tag/slash-formatter/</link><description>多元化原創文章，內容包羅萬象，有程式語言、網站應用、軟體介紹、硬體介紹、作業系統、旅行遊記、專題採訪、益智問題、文學創作，以及作者們的知識分享和作品分享。</description><language>zh-TW</language><lastBuildDate>Sun, 6 Dec 2026 18:29:20 +0800</lastBuildDate><atom:link href="https://magiclen.org/tag/slash-formatter/feed/" rel="self" type="application/rss+xml"/><sy:updatePeriod>hourly</sy:updatePeriod><sy:updateFrequency>8</sy:updateFrequency><sy:updateBase>1970-01-01T00:00+00:00</sy:updateBase><item><title>如何在 Rust 程式語言中輕鬆用斜線串接字串？</title><link>https://magiclen.org/slash-formatter/</link><description><![CDATA[<img src="https://magiclen.org/wp-content/uploads/2018/04/rust-220x162.png" srcset="https://magiclen.org/wp-content/uploads/2018/04/rust-220x162.png 1x, https://magiclen.org/wp-content/uploads/2018/04/rust-440x324.png 2x, https://magiclen.org/wp-content/uploads/2018/04/rust-660x486.png 3x" alt>
在開發程式的時候常常會需要處理檔案路徑或是 URL 網址的串接問題，如果字串是從使用者端輸入的，由於不同使用者的習慣不同，可能有人習慣在檔案目錄路徑或是網址前面後面多加斜線，也可能有人習慣不加。如果程式是設計成要用某個使用者輸入的字串當作前綴，去串接其它的字串來組成檔案路徑或是網址的話，那麼前綴是不是以斜線結尾的影響就很大了。例如使用者輸入了「path/to/folder/」這樣的檔案目錄路徑，然...]]></description><category>Rust</category><category>Rust</category><category>slash-formatter</category><guid>https://magiclen.org/slash-formatter</guid><pubDate>Mon, 19 Nov 2018 20:00:41 +0800</pubDate><dc:creator>Magic Len</dc:creator></item></channel></rss>