首页 >> 精选知识 >

文本文档怎么改成html(文本文档怎么编程序)

2022-07-30 03:05:03 来源: 用户: 

大家好,小百来为大家解答以上的问题。文本文档怎么改成html,文本文档怎么编程序这个很多人还不知道,现在让我们一起来看看吧!

1、public class Person : IComparable { public DateTime time; public string name; #region IComparable 成员 public int CompareTo(Person other) { return this.time.CompareTo(other.time); } #endregion } class Program { static void Main(string[] args) { string s = @"0时0分14秒 玩家10时0分29秒 玩家20时0分1秒 玩家30时0分34秒 玩家40时0分4秒 玩家50时0分5秒 玩家60时0分49秒 玩家70时0分30秒 玩家8"; List lst = new List(); Regex r = new Regex("(?[\S]+)[\s]+(?[\S]+)"); Match m = r.Match(s); while (m.Success) { Person p = new Person(); p.time = DateTime.Parse(m.Groups["t"].Value); p.name = m.Groups["u"].Value; lst.Add(p); m = m.NextMatch(); } //排序操作。

2、只有泛型集合中的对象实现了IComparable接口才能进行排序。

3、 lst.Sort(); foreach (Person item in lst) { Console.WriteLine(***.name + ":" + string.Format("{0:HH时MM分ss秒}", item.time)); } Console.WriteLine("Finish!!!"); Console.ReadKey(); }如果你是初学者,估计你看这段代码是会有困难的。

本文到此分享完毕,希望对大家有所帮助。

  免责声明:本文由用户上传,与本网站立场无关。财经信息仅供读者参考,并不构成投资建议。投资者据此操作,风险自担。 如有侵权请联系删除!

 
分享:
最新文章