<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Str on rustbites</title><link>https://www.rustbites.com/tags/str/</link><description>Recent content in Str on rustbites</description><generator>Hugo</generator><language>en</language><lastBuildDate>Mon, 08 Jun 2026 11:56:48 +0200</lastBuildDate><atom:link href="https://www.rustbites.com/tags/str/index.xml" rel="self" type="application/rss+xml"/><item><title>186. str::split_inclusive — Split a String and Keep the Separator With Each Chunk</title><link>https://www.rustbites.com/posts/bite-186/</link><pubDate>Sat, 06 Jun 2026 17:00:00 +0100</pubDate><guid>https://www.rustbites.com/posts/bite-186/</guid><description>&lt;p&gt;&lt;code&gt;&amp;quot;a\nb\n&amp;quot;.split('\n')&lt;/code&gt; swallows every newline &lt;em&gt;and&lt;/em&gt; hands you a phantom &lt;code&gt;&amp;quot;&amp;quot;&lt;/code&gt; at the end. &lt;code&gt;split_inclusive&lt;/code&gt; keeps each separator glued to the chunk it belongs to — no ghost element, and you can &lt;code&gt;.concat()&lt;/code&gt; straight back to the original.&lt;/p&gt;</description></item></channel></rss>