dded setLength() to pattern