Ho questo codice che mette a video 2 valori come sotto, io vorrei modificare il codice in modo che riconosce e mette a video automaticamente uno solo, quello corretto.
Focale 35mm equivalent: 29 mm 21 mm
<head>
<%!
// Strip non-numeric ending on strings and convert result to float
float numericPart(String s) {
int i;
for (i=0; i<s.length(); i++) {
char c = s.charAt(i);
if (!Character.isDigit(c) && c != '.') break;
}
return Float.parseFloat(s.substring(0,i));
}
%>
</head>
<body>
<tr><td>Focale 35mm equivalent:</td>
<td><ja:if exists="focalLength">
<%= (int)(numericPart(focalLength) * 4.0)/* Leica Digilux2 */ %> mm
</ja:if>
<ja:if exists="focalLength">
<%= (int)(numericPart(focalLength) * 3.0)/* Altra macchina */ %> mm
</ja:if>
</td>
</tr>
....
Focale 35mm equivalent: 29 mm 21 mm
<head>
<%!
// Strip non-numeric ending on strings and convert result to float
float numericPart(String s) {
int i;
for (i=0; i<s.length(); i++) {
char c = s.charAt(i);
if (!Character.isDigit(c) && c != '.') break;
}
return Float.parseFloat(s.substring(0,i));
}
%>
</head>
<body>
<tr><td>Focale 35mm equivalent:</td>
<td><ja:if exists="focalLength">
<%= (int)(numericPart(focalLength) * 4.0)/* Leica Digilux2 */ %> mm
</ja:if>
<ja:if exists="focalLength">
<%= (int)(numericPart(focalLength) * 3.0)/* Altra macchina */ %> mm
</ja:if>
</td>
</tr>
....