zoukankan      html  css  js  c++  java
  • 2009年12月小记(Split,netstat,SortedList)

    买家面对面 

    瑞雅商城

    瑞雅淘宝 

    1、string.Split

    string str = "abc$$123$4$5";
    string[] strs = str.Split(new string[] { "$$" }, StringSplitOptions.RemoveEmptyEntries);
    foreach (string s in strs)
    {
      Response.Write(s + "<hr />");
    }

     2、查看指定端口号连接情况

    netstat -abn | find "8800" 

    3、SortedList

    代码
            SortedList<intint> list = new SortedList<intint>(100);
            
    for (int i = 0; i < 100; i++)
            {
                list.Add(i, i 
    + 1000);
            }
            list.TrimExcess();

            
    for (int i = 80; i < 120; i++)
            {
                Response.Write(
    string.Format("InternalID={0}, IndexOfKey={1} <br/>", i, list.IndexOfKey(i)));
                
    int userid = 0;
                list.TryGetValue(i, 
    out userid);//userid不存在会返回0
                Response.Write(string.Format("InternalID={0}, UserId={1} <br/>", i, userid));
                Response.Write(
    "<hr />");
            }

     代码

            SortedList<intint> list = new SortedList<intint>(100);
            
    for (int i = 0; i < 100; i++)
            {
                
    //由小到大排序
                list.Add(Guid.NewGuid().ToString().GetHashCode(), i);
            }
            list.TrimExcess();

            
    foreach (KeyValuePair<intint> kv in list)
            {
                Response.Write(
    string.Format("{0}, {1}", kv.Key, kv .Value));
                Response.Write(
    "<hr />");
            }
  • 相关阅读:
    Intent
    关注博客
    Bitmap
    图片压缩
    读取相册、拍照
    Godot开发环境与学习资源
    源码开放的引擎研究
    海龟交易法操作商品期货
    重新开始
    使用node_redis进行redis数据库crud操作
  • 原文地址:https://www.cnblogs.com/chenjunbiao/p/1760301.html
Copyright © 2011-2022 走看看