Class ParagraphTextValidationBuilder

ParagraphTextValidationBuilder

适用于 ParagraphTextValidation 的 DataValidationBuilder。

// Add a paragraph text item to a form and require the answer to be at least 100
// characters.
const form = FormApp.create('My Form');
const paragraphTextItem =
    form.addParagraphTextItem().setTitle('Describe yourself:');
const paragraphtextValidation =
    FormApp.createParagraphTextValidation()
        .setHelpText('Answer must be more than 100 characters.')
        .requireTextLengthGreaterThan(100);
paragraphTextItem.setValidation(paragraphtextValidation);

详细文档

requireTextContainsPattern(pattern)

要求回答包含某种模式。

参数

名称类型说明
patternString文本必须包含指定模式

返回

ParagraphTextValidationBuilder - this(用于链式调用)


requireTextDoesNotContainPattern(pattern)

要求回答不包含某种模式。

参数

名称类型说明
patternString文本不得包含指定模式

返回

ParagraphTextValidationBuilder - this(用于链式调用)


requireTextDoesNotMatchPattern(pattern)

要求回答与模式不匹配。

参数

名称类型说明
patternString文字不得与模式匹配

返回

ParagraphTextValidationBuilder - this(用于链式调用)


requireTextLengthGreaterThanOrEqualTo(number)

要求响应长度大于或等于指定值。

参数

名称类型说明
numberInteger段落文本长度必须大于此值

返回

ParagraphTextValidationBuilder - this(用于链式调用)


requireTextLengthLessThanOrEqualTo(number)

要求回答长度小于该值。

参数

名称类型说明
numberInteger段落文本长度必须小于或等于此值

返回

ParagraphTextValidationBuilder - this(用于链式调用)


requireTextMatchesPattern(pattern)

要求回答与模式相符。

参数

名称类型说明
patternString文本必须与模式匹配

返回

ParagraphTextValidationBuilder - this(用于链式调用)