您的位置:首页 > 编程语言 > C#

C#之从当前的字符串中移除头部和尾部的空白字符和截取字符(字符串的位数)

2017-08-09 09:36 441 查看
            //从当前的字符串中移除头部和尾部的空白字符
            string str="      hello     word         ";
            string str1=str.Trim ();
            Console.WriteLine (str1);
            //截取字符串
            string str2=str1.Substring(4,6);
            Console.WriteLine (str2);
            float num=0f,sprt;
            float[] wendu = new float[7];
            for (int i = 0; i < 7; i++) {
                wendu [i] = (float)Convert.ToDouble(Console.ReadLine ());
                Console.WriteLine ();
                num += wendu [i];
            }
            sprt = num / 7;
            Console.WriteLine (sprt);
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐