length() function not available on String, use countElements instead

String doesn't have a length function, use countElements rather