You need to sign in to do that
Don't have an account?
Jaanu
How to get the length of Integer field in Apex ?
I am generating random number of length 9 digits .. sometimes, the leading zero is dropped and I am getting less than 9 digits sometimes... so, I need to check the number length in apex ..if it;s less than 9 numbers I want to generate another one. How to get the length ?
You are looking for DescribeFieldResult.getLength():
For string fields, returns the maximum size of the field in Unicode characters (not bytes).
string p = string.ValueOf(intValue);
if(p.length() < 9){
// Here wil be your code
}