How to check if a string variable contains negative value or not in java
<p>I need to put a constraint for negative values on string variable. For Eg :--</p>

<pre><code>string zeroval = "0.0000"
String x = "";
if (x==null) || (x.equals(zeroval)) { // code which checks if string x has 0 or null value
              x = "--"                // replace it by --
}
</code></pre>

<p>similarly i want to add another piece of code which checks if String x contains any negative values (for eg : <code>"-0.025"</code>) and replace it by --
The above String x should not contain null/zero/negative values</p>

<p>Please help </p>

<p>Note :- In order to add negative value check convert the string to float as i cannot use pattern matching technique for eg:- x.equals("-")</p>
