space函数是作什么用的啊?
没听说过

解决方案 »

  1.   

    string s1="abc";
    s1=s1.PadLeft(5);//在前面填加两个空格
      

  2.   

    string test = "a";
    test.PadLeft(255);
    MessageBox.Show(test.Length.ToString());
    结果是1
      

  3.   

    string test = "a";
    test.PadLeft(255);
    MessageBox.Show(test.Length.ToString());难道你要在a的前面加上254个空格吗?
      

  4.   

    这个函数有用吗???
    private String aaa(String str1, int spaceNum)
    {
    String str2 = str1;
    for(int i = 0;i<spaceNum;i++)
    {
    str2 = " " + str2;
    }
    return str2;
    }
    随便写的.
      

  5.   

    你可以使用还使用SPACE函数填空格,具体方法如下:
    添加引用->Microsoft Visual Basic.Net Runtimeusing Microsoft.VisualBasic;
    Microsoft.VisualBasic.Strings.Space(2);
      

  6.   

    To 豆豆糖
    string test = "a";
    test=test.PadLeft(255);//应该这样写
    MessageBox.Show(test.Length.ToString());
      

  7.   

    同意楼上,Padleft,PadRight是专门用来填充字符串的。String.PadLeft
    右对齐并填充字符串,以使字符串最右侧的字符到该字符串的开头为指定的距离。String.PadRight
    左对齐并填充字符串,以使字符串最右侧的字符到该字符串的结尾为指定的距离。
      

  8.   

    string paddingStr = new string(' ', 100);This will give you a string which contains exactly 100 spaces.HTH.
      

  9.   

    BTW, this is one of constructor of System.String class, so with .NET Framework, you can use it in whatever language.
      

  10.   

    using Microsoft.VisualBasic;
    Microsoft.VisualBasic.Strings.Space(2);哈哈!
      

  11.   

    不好用啊???显示的是255
    string test = "a";
    test.PadLeft(255);
    MessageBox.Show(test.Length.ToString());
      

  12.   

    TO: gxz01() 
    谢谢,惭愧