Great! But I also saw another post which is same as to the issue raised here.
But still if I use this directly in my rule, as I have mentioned already,
String lastName = StringUtils.trimToNull(inputToRule);
This was not accepted by SailPoint rule validator.
Do I missed anything here?