List之Sort使用
2024-09-20 09:51:52
void TestListSort(){
List<string> st = new List<string> ();
st.Add ("abcd");
st.Add ("abcdad");
st.Add ("a");
st.Add ("adadfaff");
st.Sort (ssort);
foreach(string str in st){
print (str);
}
}
int ssort(string str1,string str2){
if (str1.Length != str2.Length) {
if (str1.Length > str2.Length) {
return 1;
} else {
return -1;
}
} else {
return 0;
}
}
最新文章
- 当忘记mysql数据库密码时如何进行修改
- Unity 碰撞的例子
- Extract Fasta Sequences Sub Sets by position
- void及void指针含义的深刻解析
- spring技术翻译开始
- safari的input问题
- 【HighCharts系列教程】三、图表属性——chart
- 再起航,我的学习笔记之JavaScript设计模式16(享元模式)
- EF Working with Transactions
- 【杂】暴力出奇迹,lz水数据
- 【BZOJ4504】K个串
- Fedora下使用minicom及USB串口线
- 【转】【Centos】安装 lnmpa 集成开发环境
- 使用 requests 发送 GET 请求
- WeakHashMap 理解
- Angularjs 首次加载显示{{}}
- python 之sqlite3库学习
- SQL 关联两个表的视图总结
- UVALive 6906 A - Cluster Analysis
- nginx1.11.9 apt即源码编译各平台测试