zoukankan      html  css  js  c++  java
  • C#第十节课

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;

    namespace 类
    {
    class Program
    {
    static void Main(string[] args)
    {
    //String Math
    string a = " abCdefgd8 ";
    int c = a.IndexOf("d");//从前面开始找,找到第一个,数它的索引号
    int d = a.LastIndexOf("d");
    bool b = a.Contains("dd");//是否包含此字符串
    Console.WriteLine(d);

    //int b = a.Length;//长度
    //Console.WriteLine(b);


    //string c = a.Trim();//去掉前后空格
    //Console.Write(c);
    //Console.Write(" ");
    //string d = a.TrimStart();//去掉前空格
    //Console.Write(d);
    //Console.Write(" ");
    //string e = a.TrimEnd();//去掉后空格
    //Console.Write(e);
    //Console.Write(" ");
    //string f = a.ToUpper();//全部将小写字母转换为大写
    //Console.WriteLine(f);
    //string g = a.ToLower();//全部将大写字母转换为小写
    //Console.WriteLine(g);


    ////索引号是从0开始的
    //string h = a.Substring(4);
    ////里面一个值,表示从这个索引开始一直截取到最后
    //Console.WriteLine(h);
    //Console.WriteLine(a.Substring(8));

    ////a = a.Substring(8);//若果不重新赋值,a是没有变化的

    ////两个值,表示从哪个索引号开始,截取多少长度
    //string i = a.Substring(4,3);
    //Console.WriteLine(i);


    //a=a.Replace("de", "DE");

    //Console.WriteLine(a);


    //string j = "2012 12 23";
    //string [] aa= j.Split( );//分割字符串,以什么字符
    //foreach (string m in aa)
    //{
    // Console.WriteLine(m);
    //}

    //Math类
    //double a=4.14;
    //Console.WriteLine(Math.Ceiling(a));//取上线
    //Console.WriteLine(Math.Floor(a));//取下线
    //Console.WriteLine(Math.PI*a);//π 圆周率
    //Console.WriteLine(Math.Round(a));//四舍五入
    //注意:奇数.5的情况下,取上线
    //偶数.5的情况下,取下线


    Console.ReadLine();


    }
    }
    }

  • 相关阅读:
    Maven错误recv failed
    eclipse集成tomcat修改字符集参数
    eclipse luna 无法安装veloeclipse问题
    TortoiseSVN忽略文件夹
    类之特性
    __new()__与__init__()
    flask中models设计
    flask读书记录
    JS中的event 对象详解
    redis 持久化 RDB
  • 原文地址:https://www.cnblogs.com/xiongxiaobai/p/5266423.html
Copyright © 2011-2022 走看看