#region DateTime操作 public class C3 { //DateTime常用的操作 public static void Fun1() { //格式:2012-8-16 11:21:29 Console.WriteLine("当前时间:{0}", DateTime.Now.ToString()); //格式:2012-8-16 0:00:00 Console.WriteLine("日期部分:{0}", DateTime.Now.Date.ToS…
//String 字符串的常见操作 public static void Fun1() { string MyStr = " Hello World! "; //length长度属性 Console.WriteLine(MyStr.Length); //Substring()截取 Console.WriteLine(MyStr.Substring(, )); //ToCharArray()转换为字符数组 char[] charr = MyStr.ToCharArray(); //ToU…
导言:本系列博客目的在于能够在vs快速上手opencv,理论知识涉及较少,大家有兴趣可以查阅其他博客深入了解相关的理论知识,本博客后续也会对图像方向的理论进一步分析,敬请期待:) 上篇传送:http://www.cnblogs.com/always-chang/p/6170727.html 学习思维导图: 5.图像轮廓检测 主要函数介绍: 1)cvFindContours 函数功能:对图像进行轮廓检测,这个函数将生成一条链表以保存检测出的各个轮廓信息,并传出指向这条链表表头的指针. 函数原型:…
导言:本系列博客目的在于能够在vs快速上手opencv,理论知识涉及较少,大家有兴趣可以查阅其他博客深入了解相关的理论知识,本博客后续也会对图像方向的理论进一步分析,敬请期待:) PS:官方文档永远是最好的入门资料,逐步提高英文阅读能力也很重要:) 官方文档传送门: [英]http://www.docs.opencv.org/2.4.6/# [中]http://www.opencv.org.cn/opencvdoc/2.3.2/html/doc/tutorials/tutorials.html…
//字符串的内存驻留机制 public static void Test() { //当有多个字符串变量包含了同样的字符串实际值时, //CLR可能不会为它们重复地分配内存,而是让它们统统指向同一个字符串对象实例. String s1 = "Hello"; String s2 = "Hello"; bool same = (object)s1 == (object)s2;//比较一下s1和s2是否是同一个引用 Console.WriteLine(same); //这…
#region 查找与替换 public class C4 { //查找 public static void StrFind() { //目标字符串 string str1 = "~awefawetwe1225233456567567 56yuethy56uhdfhtw wyw3234t#%#gdf drte rtr5 4sdfasg dsfasdf asghfasdfasdghsdfgdf"; string str2 = "~"; //报告指定的 System.…
// 判断输入的是否全是数字:返回结果:true:全是数字:false:有字幕出现 public static bool Isaccord1(string str) { bool bl = true; foreach (char ch in str) { //不包含小数点只判断输入的字符全部是由数字组成 //如果包含小数点,那么小数点有且仅有一个且不能在首位且全部由数字组成 //在方法里面调用方法 //"或"--两个当中只要有一个为真就为真 "且"--同真同假 &q…
//看看字符串的特殊之处值类型与引用类型的区别 public static void CompareString(string stra, string strb, int i) { #region 总结 :值类型与引用类型的区别 /* string 是引用类型,但在使用时有表现出一些值类型的特点 string 是只读的,不能修改该对象实例的值,实际操作中对 该对象的修改返回的是该对象的新的实例. string 对象保留在堆上,而不是栈上. 当相同的字符串赋值到两个string变量时,会得到相同…
//StringBiulder string char[]之间的转化 public static void Fun3() { StringBuilder sb = new StringBuilder("I Like Programming!"); //把stringBiulder对象转化为字符串 string strA = sb.ToString(); Console.WriteLine("SringBiulder对象转化为字符串" + strA); //字符串转化…
//测试StringBuilder的运行效率 public static void Fun2() { #region string string str = "我喜欢编程!"; //提供一组方法和属性,可用于准确地测量运行时间. Stopwatch stopw = new Stopwatch(); //开始或继续测量某个时间间隔的运行时间. stopw.Start(); ; i < ; i++) { str += "Test"; } //停止测量某个时间间隔的…