code: protected String safeStringFromProperty(StringProperty stringProperty, String field, List<FieldError> errorsBuilder,
                                              int maxLen, StringFieldType fieldType) {
          String s = stringProperty.get();
          if(fieldType == StringFieldType.OPTIONAL &&  s.length() > maxLen) {
              errorsBuilder.add(new FieldError("field must be less than " + maxLen + " characters", field));
          }
          else if(fieldType != StringFieldType.OPTIONAL  && (s.length() > maxLen || s.isEmpty())) {
              errorsBuilder.add(new FieldError("field must not be blank and less than " + maxLen + " characters", field));
          }
  
          if(fieldType == StringFieldType.VARIABLE && !s.matches("^[\\p{L}_$][\\p{L}\\p{N}_]*$")) {
              errorsBuilder.add(new FieldError("Function fields must use only letters, digits, and '_'", field));
          }
          else if(!s.matches("^[\\p{L}\\p{N}\\s\\-_*%()]*$")) {
              errorsBuilder.add(new FieldError("Text can only contain letters, numbers, spaces and '-_()*%'", field));
          }
          return s;
      }
docs: Gets the string value from a text field and validates it is correct in terms of length and content.
  @param stringProperty the string property to get the string from
  @param field the field name to report errors against
  @param errorsBuilder the list of errors reported so far
  @param maxLen the maximum allowable length
  @param fieldType the type of field which changes the method of evaluation.
  @return the string once checked