开发者

Active directory employee number validation

I have this issue with new employee number format, when I search Active Directory for example with "07789", it returns me a result.But if I take the "0" off and search "7789" it will not find the record thinks 07789 and 7789 are different. But in the database the employee number field is an integer, so it always treats 07789 as 7789 and saves it in the database. Is there is any smarter way to handle this problem rather than changing the column data type and h开发者_开发技巧andle employee numbers as strings?


Are the numbers always the same length? You could do something like this:

NumberFormat numberFormat = NumberFormat.getInstance();
numberFormat.setMinimumIntegerDigits(5);
numberFormat.setMaximumIntegerDigits(5);
numberFormat.setGroupingUsed(false);
String numberString = numberFormat.format((long) 7789);

System.out.println(numberString);  //"07789"
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜