C#中,取字符串长度的函数是什么呢?一时忘了

解决方案 »

  1.   

    String.Length 属性 不是方法
      

  2.   

    没什么方法
    你用 Length 直接获取啊
    string s = "abc";
    int i = s.Length;
    i 就是长度
      

  3.   

    整数长度?
    比如369
    你是说看作字符串的长度
    还是整数本身的长度 如果是后者 没有这个概念
    只有int32的范围
    Int32 值类型表示值介于 -2,147,483,648 到 +2,147,483,647 之间的有符号整数。
      

  4.   

    麻烦帮我看下这代码哪里错
     void page_load( object sender,EventArgs e)
       { 
       if (!IsPostBack) 
       {
        int IntCount,IntActive;
        int i, j, theLen;
        IntCount = Convert.ToInt32(Application["currcount"]);
         IntActive = Convert.ToInt32(Application["active"]);
        
        theLen =IntCount.length;
           int i=1;
        while (theLen)
        { str1=Mid(Trim(IntCount),1,1);
        Image pict=new Image();
        pict.Width=13;
        pict.Height=21;
        pict.ImageUrl="images/numeric" &Trim(str1)& ".gif" ;
        PlaceHolder1.control.add(pict);
        }
            
        theLen=Len(Trim( IntActive));
           int i=1;
           while (theLen)
           {
               str1 = Mid(Trim(IntActive), 1, 1);
               Image pict = new Image();
               pict.Width = 13;
               pict.Height = 21;
               pict.ImageUrl = "images/numeric" & Trim(str1) & ".gif";
               PlaceHolder2.control.add(pict);
           }
        }
        
     }
     
    </script>编译器错误信息: CS0117: “int”并不包含“length”的定义theLen =IntCount.length;
      

  5.   

    IntCount 是 int 类型
    没有 length 属性
    theLen = IntCount.ToString().Length;
    注意是 Length 不是 length