用星星代替文字

时间:2018-05-31 17:41:59

标签: input replace passwords

美好的一天,

我只是做基本的,非常基本的HTML,CSS编码而且无法完成我的最新任务 - 希望能在这里得到答案。

我想要一个输入字段,当我粘贴一个像somethingnice@gmail.com这样的电子邮件地址时,会将其转换为so*****@gmail.com并将其放入段落中。基本上它应该保留前两个字母,然后放5颗星(比如密码),然后保留@之后的内容。如果无论电子邮件地址的长度如何都难以做到5星,如果它只是替换前两个字母和@和星星的字符,我会更高兴。

此致 桑尼

1 个答案:

答案 0 :(得分:0)

/// <summary>
/// Used for debug
/// </summary>
/// <param name="msg"></param>
/// <returns></returns>
private string GetFirebaseMessageString(FirebaseMessage msg)
{
    var builder = new StringBuilder();

    builder.AppendLine("############# Firebase Message #############");
    builder.AppendLine(string.Format("Message Id: {0}", msg.MessageId));
    builder.AppendLine(string.Format("Message Type: {0}", msg.MessageType));
    builder.AppendLine(string.Format("Priority: {0}", msg.Priority));
    builder.AppendLine(string.Format("From: {0}", msg.From));
    builder.AppendLine(string.Format("To: {0}", msg.To));
    builder.AppendLine(string.Format("Collapse Key: {0}", msg.CollapseKey));
    builder.AppendLine(string.Format("Error: {0}", msg.Error));
    builder.AppendLine(string.Format("Error Description: {0}", msg.ErrorDescription));
    builder.AppendLine(string.Format("Time To Live: {0}", msg.TimeToLive));
    builder.AppendLine(string.Format("Raw Data: {0}", msg.RawData));
    builder.AppendLine(string.Format("Notification Opened: {0}", msg.NotificationOpened));
    if (msg.Notification != null)
    {
        builder.AppendLine(string.Format(".Notification Title: {0}", msg.Notification.Title));
        builder.AppendLine(string.Format(".Notification Tag: {0}", msg.Notification.Tag));
        builder.AppendLine(string.Format(".Notification Body: {0}", msg.Notification.Body));
        builder.AppendLine(string.Format(".Notification ClickAction: {0}", msg.Notification.ClickAction));
        builder.AppendLine(string.Format(".Notification Sound: {0}", msg.Notification.Sound));
    }
    builder.AppendLine("############# End #############");

    return builder.ToString();
}

查看以下链接: