on 04-18-2009 11:17 AM
Hi Frnds,
I need UDF for checking for non-numeric( like it starting with negative number ),alphanumeric, if its null, if it having 00000's
this will be the code
try
{
Integer.parseInt(input);
return true;
}
catch( Exception e )
{
return false;
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
public String isAlphaNumeric(String a,Container container){
boolean isInteger = false;
try{
int i = Integer.parseInt(a.trim());
isInteger = true;
}
catch(NumberFormatException e){
isInteger = false;
}
String ret = "";
if(isInteger){
ret = u201CNumerical Charactersu201D;
}
else{
ret = u201CAlphaNumerical Charactersu201D;
}
return ret;
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
try the following code
String in = "868686123";
if(in.length()>0 && in.matches(" \ \ d*")){
return in;
}
else
throw new RuntimeException("Non-numeric");
}
With Regards
Venkat
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Praveen,
Take input parameter is a.
if ( a == NULL) // For Checking the NULL value
return "null value";
else if(a.matches("
p+")) // It is pattern for Checking the Alpha Numeric or not,
return "alpha Numeric";
else
if (a < 0) return " Negative number"; // For Checking the value is it negative or not
else return "Positive Number";
Here we have to import java.util.regex.*;
For more info
http://leepoint.net/notes-java/data/strings/40regular_expressions/26pattern-matcher.html
Regards
Ramesh
User | Count |
---|---|
89 | |
10 | |
10 | |
9 | |
6 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.