Quantcast
Viewing all articles
Browse latest Browse all 2

If else statement with a substring

I'm attempting to make an if else statement in which the middle value looks to see if the 4th digit in the sub string is an integer if it is I want a negative in front of the number if its not i want no negative in front. The error im getting is on the else if line that it needs a boolean and finds an int how can I fix this so the else if line checks if sub string 4 is an int?

 if (strAlt.equals("03"))   {       return  "N/A";   }   else if (Integer.parseInt(strPos.substring(4)))   {       return "-"+strPos.substring(4,7) +"C";           }         else    {       return strPos.substring(4,7) +"C";    }

Viewing all articles
Browse latest Browse all 2

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>