首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > asp.net >

怎么根据每个单词的首字母进行排序

2012-04-17 
如何根据每个单词的首字母进行排序例如排序前输出:while if for break switch排序后输出:break for if swi

如何根据每个单词的首字母进行排序
例如 排序前输出:while if for break switch

排序后输出:break for if switch while


给个思路,

[解决办法]

C# code
SortedList mySortedList = new SortedList();        //while if for break switch        mySortedList["while"] = "while";        mySortedList["if"] = "if";        mySortedList["for"] = "for";        mySortedList["break"] = "break";        mySortedList["switch"] = "switch";        if (!IsPostBack)        {            string s=string.Empty;            foreach (DictionaryEntry Item in mySortedList)            {                s += Item.Value.ToString()+" ";            }            Response.Write(s);        } 

热点排行