我想允许用户只添加数字“12345”和十进制数字(如“21321.12312”)和负数(如-23423.32432)。用户不应该能够添加多个“.” 比如“12..32”,并在第一个输入中添加“-”,比如-324.34,而不是324-4323。我使用了这个正则表达式r'^(-?\d+\.\d+)(\s*,\s*-?\d+\.\d+)+$',但无法输入任何内容。
文本字段代码:
TextFormField(
inputFormatters: [
FilteringTextInputFormatter.allow(
RegExp(r'^(-?\d+\.\d+)(\s*,\s*-?\d+\.\d+)+$')),
],
controller: budget,
keyboardType: TextInputType.number,
decoration: InputDecoration(
contentPadding:
EdgeInsets.only(right: 20, left: 20, top: 10, bottom: 10),
hintText: getTranslated(context, "budget_example"),
hintStyle: TextStyle(fontSize: 13, fontFamily: "tahoma"),
border: OutlineInputBorder(
borderSide: BorderSide(width: 1, color: MyColors.secondary),
borderRadius: BorderRadius.circular(100),
),
),
),
Run Code Online (Sandbox Code Playgroud) 有人可以指出我可以在哪里找到一个实现CombineFileInputFormat(org.使用Hadoop 0.20.205?这是使用EMR从非常小的日志文件(行中的文本)创建大型分割.
令人惊讶的是,Hadoop没有专门为此目的而制作的这个类的默认实现,并且谷歌搜索看起来我并不是唯一一个被这个混淆的人.我需要编译类并将其捆绑在一个jar中,用于hadoop-streaming,对Java知之甚少,这是一个挑战.
编辑:我已经尝试了butitrails示例,使用了必要的导入但是我得到了下一个方法的编译器错误.
I've got a TextField in my flutter app, for help inputting numbers for a calculator function. For this TextField, I have set the keyboard to be numbers only, using
keyboardType: TextInputType.number
Now, this works perfectly, in a sense that it ensures only the number input keyboard appears. This keyboard allows the user to input numbers from 0 to 9, as well as a decimal point. The problem is, it doesn't stop users inputting multiple decimal points. Once a user adds …
我需要构建一个ASP.NET Core 2.0 Web API应用程序,该应用程序将能够完成自定义XML输入和输出格式。
我已经成功设置了一个自定义输出格式化程序,但是没有一个自定义输入格式化程序。
更准确地说,这是启动配置:
public void ConfigureServices(IServiceCollection services)
{
services
.AddMvc(opt =>
{
opt.ReturnHttpNotAcceptable = true;
opt.OutputFormatters.Clear();
opt.InputFormatters.Clear();
opt.InputFormatters.Add(new SoapInputFormatter());
opt.OutputFormatters.Add(new SoapOutputFormatter());
});
}
Run Code Online (Sandbox Code Playgroud)
这个想法是具有定制的SOAP输入和输出格式。不,现有的XmlDataContractSerializerInputFormatter不会。
本SoapOutputFormatter类:
public class SoapOutputFormatter : IOutputFormatter
{
public bool CanWriteResult(OutputFormatterCanWriteContext context)
{
return true;
}
public async Task WriteAsync(OutputFormatterWriteContext context)
{
var bytes = Encoding.UTF8.GetBytes(context.Object.ToString());
await context.HttpContext.Response.Body.WriteAsync(bytes, 0, bytes.Length);
}
}
Run Code Online (Sandbox Code Playgroud)
和SoapInputFormatter班级:
public class SoapInputFormatter : InputFormatter
{
public override Task<InputFormatterResult> ReadRequestBodyAsync(InputFormatterContext context)
{
throw new …Run Code Online (Sandbox Code Playgroud) c# asp.net-web-api asp.net-core asp.net-core-2.0 inputformatter