我想使用 FilteringTextInputFormatter.allow(RegExp()) 驗證我的 ssn,
我希望它以 1 或 2 開頭,長度為 10,最后 9 個數字為任意數字,只有第一個應該是 1 或 2
uj5u.com熱心網友回復:
TextFormField(
inputFormatters: [
LengthLimitingTextInputFormatter(10),
FilteringTextInputFormatter.allow(RegExp(r'^[12][0-9]*$')),
],
decoration: InputDecoration(
border: InputBorder.none,
labelText: 'PAN Number',
),
)
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/439608.html
下一篇:按鈕串列選擇
