【问题标题】:Remove whitespace from textbox on run time while typing text键入文本时在运行时从文本框中删除空格
【发布时间】:2021-05-23 03:14:24
【问题描述】:

我必须删除用户名文本框 android 中的空格。总是会出现空格,例如(john. james)这样的请让我知道如何解决这个问题,而打字时不应有任何空格。

【问题讨论】:

标签: c# android xamarin.forms xamarin.android visual-studio-2019


【解决方案1】:

这应该可以解决您的问题

using System.Text.RegularExpressions;

private void TextBox1_TextChanged(object sender, EventArgs e)
{
   TextBox1.Text = Regex.Replace(TextBox1.Text, " ", "");
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-04-27
    • 1970-01-01
    • 1970-01-01
    • 2012-05-04
    • 2018-03-11
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多