I am familair with and did use StrLength for this code but I was not sure if it inherited from NonEmptyStr which would cause the data to fail validation, StrLenght[1, 2871] might work but if the value meets the constraint, there is no way to coerce it.