title: What is the correct & idiomatic way to check if a string starts with a certain character in Rust?
body: <p>I want to check whether a string starts with some chars:</p>
  
  <pre><code>for line in lines_of_text.split("\n").collect::&lt;Vec&lt;_&gt;&gt;().iter() {
      let rendered = match line.char_at(0) {
          '#' =&gt; {
              // Heading
              Cyan.paint(*line).to_string()
          }
          '&gt;' =&gt; {
              // Quotation
              White.paint(*line).to_string()
          }
          '-' =&gt; {
              // Inline list
              Green.paint(*line).to_string()
          }
          '`' =&gt; {
              // Code
              White.paint(*line).to_string()
          }
          _ =&gt; (*line).to_string(),
      };
      println!("{:?}", rendered);
  }
  </code></pre>
  
  <p>I've used <code>char_at</code>, but it reports an error due to its instability.</p>
  
  <pre class="lang-none prettyprint-override"><code>main.rs:49:29: 49:39 error: use of unstable library feature 'str_char': frequently replaced by the chars() iterator, this method may be removed or possibly renamed in the future; it is normally replaced by chars/char_indices iterators or by getting the first char from a subslice (see issue #27754)
  main.rs:49      let rendered = match line.char_at(0) {
                                        ^~~~~~~~~~
  </code></pre>
  
  <p>I'm currently using Rust 1.5</p>