How to split String without regex
<p>In my Java application I need to find indices and split strings using the <strong>same</strong> "target" for both occasions. The target is simply a dot.</p>

<p>Finding indices (by indexOf and lastIndexOf) does not use regex, so</p>

<pre><code>String target = ".";
String someString = "123.456";
int index = someString.indexOf(target); // index == 3
</code></pre>

<p>gives me the index I need.</p>

<p>However, I also want to use this "target" to split some strings. But now the target string is interpreted as a regex string. So I can't use the same target string as before when I want to split a string...</p>

<pre><code>String target = ".";
String someString = "123.456";
String[] someStringSplit = someString.split(target); // someStringSplit is an empty array
</code></pre>

<p>So I need either of the following:</p>

<ol>
<li>A way to split into an array by a non-regex target</li>
<li>A way to "convert" a non-regex target string into a regex string</li>
</ol>

<p>Can someone help? Would you agree that it seems a bit odd of the standard java platform to use regex for "split" while not using regex for "indexOf"?</p>