Slice string by character and not index
<p>I want to create variable from a long string to a small string.</p>

<p>e.g <code>abcde!mdamdskm</code> to <code>abcde</code>.</p>

<p>I know only what is the special character and not the index.</p>