zoukankan      html  css  js  c++  java
  • 所有下划线替换成文本框并且ID不同

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Text.RegularExpressions;


    string sAnswer = "";
    string[] Answer = Regex.Split(lbQuestion.Text, "_+", RegexOptions.IgnoreCase);
    for (int i = 0; i < (Answer.Count() - 1); i++)
    {
    if (Answer[0] == "")
    {
    Answer[0] = "<input type="text" id=txtRightAnswer" + 0 + " style="background-color:#ceedff; border:none; border-bottom:solid 1px black;" />";
    }
    else if (i == (Answer.Count() - 1) && Answer[(Answer.Count() - 1)] == "")
    {
    Answer[(Answer.Count() - 1)] = "<input type="text" id=txtRightAnswer" + (Answer.Count() - 1) + " style="background-color:#ceedff; border:none; border-bottom:solid 1px black;" />";
    }
    else
    {
    Answer[i] += "<input type="text" id=txtRightAnswer" + i + " style="background-color:#ceedff;border:none; border-bottom:solid 1px black;" />";
    }
    }
    for (int j = 0; j < Answer.Length; j++)
    {
    sAnswer += Answer[j];
    }
    Control c = ParseControl(sAnswer);
    Panel1.Controls.Clear();
    Panel1.Controls.Add(c);

  • 相关阅读:
    快速排序
    优先队列
    堆排序
    树、二叉树基础
    分治法
    递归算法详细分析
    算法基础
    Linux文件系统详解
    fs/ext2/inode.c相关函数注释
    块设备的读流程分析
  • 原文地址:https://www.cnblogs.com/liziqiang/p/3437347.html
Copyright © 2011-2022 走看看