如何从管道中获取参数输入并强制3位数字?
我有一个参数输入字段,用户能够输入数字。我想将其限制在3位数字中,如果少于3位,请强制3位数字。我尝试了“格式” - 它,但数字似乎是我尝试过的所有内容的无效类型...
parameters:
- name: someNums
type: number
default: 0
parameters:
- name: rightNums
value: ${{ format('{0:000}', parameters.someNums) }}
我也尝试了{0:d3}
& {0:###}
& {0:n2}
无用...
通过运行的许多阶段需要此值,因此我宁愿在每个阶段都必须这样做(这就是为什么我要尝试多变的)。
I have a parameter input field that a user is able to enter numbers into. I want to limit it to 3 digits and if it is any less, force 3 digits. I have tried "format"-ing it but number seems to be an invalid type for everything I've tried...
parameters:
- name: someNums
type: number
default: 0
parameters:
- name: rightNums
value: ${{ format('{0:000}', parameters.someNums) }}
I have also tried {0:D3}
& {0:###}
& {0:N2}
to no avail...
This value is needed through a lot of stages that run so I would prefer not to have to do it in each stage (which is why I was trying for variable).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
恐怕没有这种方法可以将参数输入迫使3位数字。
Azure DevOps不支持判断输入参数暂时强制参数的格式。
对于解决方法,您可以在作业/阶段/步骤中添加表达式,以检查三位数号码,以确定是否需要运行它。
这是一个示例:
我可以完全理解您的要求,您可以创建a 建议反馈反馈反馈反馈。 报告功能要求。
I am afraid that there is no such method can force the parameter input to 3 digit numbers.
Azure DevOps does not support judging input parameters to force the format of parameters for the time being.
For a workaround, you can add expressions in job/stage/step to check for three digit numbers to determine if it needs to be run.
Here is an example:
I can fully understand your requirement, you can create a suggestion feedback to report the feature requirement.