Title description Implement a function to determine whether a string represents a numeric value (including integers and decimals). For example, the string "+100", "5e2", "123", "3.1416" and " -1E-16" all represent numeric values. But "12e", "1a3.14", "1.2.3", "+-5" and "12e+4.3" are not. public class Solution { private int inx; public boolean isnumeric (char[] str) { if (str = = NULL | | str.length = = 0) { return false; } inx = 0; boolean flag = Scaninteger (str); //Judging if (Inx < str.length && Str[inx] = = '. ') { inx = Inx + 1; flag = Scanuinteger (str) | | Flag //explain a, see below code &NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;}&NBSP;&NBSP;&NBSP;&NBSP;&NBSP; //Judgment Index part if (Inx < str.length && (str[inx]== ' e ' | | str[inx]== ' E ')) { inx = Inx + 1; flag = Flag && scaninteger (str); } return flag && Inx = = str.length; } //determines whether the integer public boolean scaninteger (char[] str) { if (Inx < Str.length && (Str[inx] = = ' + ' | | str[inx] = = '-')) { inx = Inx + 1; } return Scanuinteger (str); } // Determines whether the unsigned integer public boolean scanuinteger (char[] str) {&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBsp; int inx1 = Inx; while (Inx < str.length && Str[inx] >= ' 0 ' && Str[inx] <= ' 9 ') { inx = Inx + 1; } return inx > inx1; }}a. The reason why the use of | |, but not the use of &&. Decimals can have no integer part, such as. 123 equals 0.123, there can be no number after the decimal point, such as 233. equals 233.0; Of course, there can be numbers before and after the decimal point, such as 1.123;
A string that represents a numeric value