using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Text.RegularExpressions; namespace IBO.XJMYQP.Utility
{
public static class Extension
{
#region String Extension public static string[] Split(this string val, string code)
{
return Regex.Split(val, code);
} public static bool IsNullOrEmpty(this string val)
{
return string.IsNullOrEmpty(val);
} public static bool IsNotEmpty(this string val)
{
return !string.IsNullOrEmpty(val);
} public static string ToString2(this object val)
{
if (val == null)
return string.Empty;
return val.ToString();
} /// <summary>
/// 将1900-01-01或 0001/1/1 转换为空字符串
/// </summary>
/// <param name="val"></param>
/// <returns></returns>
public static string ToVaildDateTime(this object val)
{
if (val == null)
return string.Empty;
else if (val.ToString() == "0001/1/1 0:00:00")
return string.Empty;
else if (val.ToString() == "1900-01-01 00:00:00.000" || val.ToString() == "1900/1/1 0:00:00")
return string.Empty;
return val.ToString();
} /// <summary>
/// 将空值和NULL值转换为一个默认的时间1900-01-01
/// </summary>
/// <param name="val"></param>
/// <returns></returns>
public static string ToInVaildDateTime(this object val)
{
if (val == null)
return "1900-01-01";
else if (val.ToString2().IsNullOrEmpty())
return "1900-01-01";
return val.ToString();
} /// <summary>
/// 判断字符串是否是数字
/// </summary>
public static bool IsNumeral(this string val)
{
decimal i = 0;
return decimal.TryParse(val, out i);
} /// <summary>
/// 清除空格,加入非空判断,空字符串调用也不会报错
/// </summary>
public static string TrimSpace(this string val)
{
if (val == null)
return null;
else
return val.Trim();
} public static bool Contains(this string val, string value, StringComparison comp)
{
return val.IndexOf(value, comp) >= 0;
} public static DateTime? ToDateTime(this string val)
{
if (string.IsNullOrEmpty(val)) return null;
DateTime dt;
if (DateTime.TryParse(val, out dt))
{
return dt;
}
return null;
} public static bool ToBoolean(this string val)
{
if (string.IsNullOrEmpty(val)) return false;
return val == Boolean.TrueString;
} public static int ToInt(this string val)
{
int intValue;
if (int.TryParse(val, out intValue))
{
return intValue;
}
return 0;
} public static long ToLong(this string val)
{
long intValue;
if (long.TryParse(val, out intValue))
{
return intValue;
}
return 0;
} public static decimal ToDecimal(this string val)
{
decimal intValue;
if (decimal.TryParse(val, out intValue))
{
return intValue;
}
return 0;
} public static double ToDouble(this string val)
{
double result;
if (double.TryParse(val, out result))
{
return result;
}
return 0;
} public static float ToFloat(this string val)
{
float result;
if (float.TryParse(val, out result))
{
return result;
}
return 0;
} /// <summary>
/// 按照长度截取字符串
/// </summary>
/// <param name="val"></param>
/// <param name="length"></param>
/// <returns></returns>
public static string Truncate(this string val, int length)
{
if (string.IsNullOrEmpty(val))
return val;
return (val.Length > length ? val.Substring(0, length - 1) : val);
} /// <summary>
/// 按照长度截取字符串
/// </summary>
/// <param name="val"></param>
/// <param name="length"></param>
/// <param name="coda">结尾符号</param>
/// <returns></returns>
public static string Truncate(this string val, int length, string coda)
{
if (string.IsNullOrEmpty(val))
return val;
return (val.Length > length ? val.Substring(0, length - 1) + coda : val);
} public static int ParseDayOfWeek(this string val)
{
val = val.ToLower();
switch (val)
{
case "monday":
return 1;
case "tuesday":
return 2;
case "wednesday":
return 3;
case "thursday":
return 4;
case "friday":
return 5;
case "saturday":
return 6;
case "sunday":
return 7;
default:
return 0;
}
} /// <summary>
/// 截取指定字节长度的字符串
/// </summary>
/// <param name="str">原字符串</param>
/// <param name="len">截取字节长度</param>
/// <returns></returns>
public static string CutByteString(this string str, int len)
{
string result = string.Empty;// 最终返回的结果
if (string.IsNullOrEmpty(str)) { return result; }
int byteLen = System.Text.Encoding.Default.GetByteCount(str);// 单字节字符长度
int charLen = str.Length;// 把字符平等对待时的字符串长度
int byteCount = 0;// 记录读取进度
int pos = 0;// 记录截取位置
if (byteLen > len)
{
for (int i = 0; i < charLen; i++)
{
if (Convert.ToInt32(str.ToCharArray()[i]) > 255)// 按中文字符计算加2
{ byteCount += 2; }
else// 按英文字符计算加1
{ byteCount += 1; }
if (byteCount > len)// 超出时只记下上一个有效位置
{
pos = i;
break;
}
else if (byteCount == len)// 记下当前位置
{
pos = i + 1;
break;
}
}
if (pos >= 0)
{ result = str.Substring(0, pos); }
}
else
{ result = str; }
return result;
} /// <summary>
/// 截取指定字节长度的字符串
/// </summary>
/// <param name="str">原字符串</param>
/// <param name="startIndex">起始位置</param>
/// <param name="len">截取字节长度</param>
/// <returns></returns>
public static string CutByteString(this string str, int startIndex, int len)
{
string result = string.Empty;// 最终返回的结果
if (string.IsNullOrEmpty(str)) { return result; } int byteLen = System.Text.Encoding.Default.GetByteCount(str);// 单字节字符长度
int charLen = str.Length;// 把字符平等对待时的字符串长度 if (startIndex == 0)
{ return CutByteString(str, len); }
else if (startIndex >= byteLen)
{ return result; }
else //startIndex < byteLen
{
int AllLen = startIndex + len;
int byteCountStart = 0;// 记录读取进度
int byteCountEnd = 0;// 记录读取进度
int startpos = 0;// 记录截取位置
int endpos = 0;// 记录截取位置
for (int i = 0; i < charLen; i++)
{
if (Convert.ToInt32(str.ToCharArray()[i]) > 255)// 按中文字符计算加2
{ byteCountStart += 2; }
else// 按英文字符计算加1
{ byteCountStart += 1; }
if (byteCountStart > startIndex)// 超出时只记下上一个有效位置
{
startpos = i;
AllLen = startIndex + len - 1;
break;
}
else if (byteCountStart == startIndex)// 记下当前位置
{
startpos = i + 1;
break;
}
} if (startIndex + len <= byteLen)//截取字符在总长以内
{
for (int i = 0; i < charLen; i++)
{
if (Convert.ToInt32(str.ToCharArray()[i]) > 255)// 按中文字符计算加2
{ byteCountEnd += 2; }
else// 按英文字符计算加1
{ byteCountEnd += 1; }
if (byteCountEnd > AllLen)// 超出时只记下上一个有效位置
{
endpos = i;
break;
}
else if (byteCountEnd == AllLen)// 记下当前位置
{
endpos = i + 1;
break;
}
}
endpos = endpos - startpos;
}
else if (startIndex + len > byteLen)//截取字符超出总长
{
endpos = charLen - startpos;
}
if (endpos >= 0)
{ result = str.Substring(startpos, endpos); }
}
return result;
} #endregion #region Object Extension public static DateTime? ToDateTime(this object val)
{
if (val == null) return null;
return val.ToString().ToDateTime();
} public static DateTime ToDateTime2(this object val)
{
if (val == null) return DateTime.MinValue;
var time = val.ToString().ToDateTime();
return time.HasValue ? time.Value : DateTime.MinValue;
} public static Guid ToGuid(this object val)
{
//=>3.5没有提供Guid.TryParse 方法。
if (val == null) return Guid.Empty;
Guid gd;
try
{
gd = new Guid(val.ToString2());
return gd;
}
catch
{
return Guid.Empty;
}
} public static bool ToBoolean(this object val)
{
if (val == null) return false;
return val.ToString().ToBoolean();
} public static int ToInt(this object val)
{
if (val == null) return 0;
return val.ToString().ToInt();
} public static long ToLong(this object val)
{
if (val == null) return 0;
return val.ToString().ToLong();
} public static int ToIndexInt(this object val)
{
if (val == null) return -1;
return val.ToString().ToInt();
} public static decimal ToDecimal(this object val)
{
if (val == null) return 0;
return val.ToString().ToDecimal();
} public static double ToDouble(this object val)
{
if (val == null) return 0;
return val.ToString().ToDouble();
}
public static float ToFloat(this object val)
{
if (val == null) return 0;
return val.ToString().ToFloat();
} /// <summary>
/// 对象转换为Json
/// </summary>
/// <param name="jsonObject">对象</param>
/// <returns>Json字符串</returns>
public static string ToJson(this object jsonObject)
{
string jsonString = "{";
PropertyInfo[] propertyInfo = jsonObject.GetType().GetProperties();
for (int i = 0; i < propertyInfo.Length; i++)
{
object objectValue = propertyInfo[i].GetGetMethod().Invoke(jsonObject, null);
string value = string.Empty;
if (objectValue is DateTime || objectValue is Guid || objectValue is TimeSpan)
{
value = "'" + objectValue.ToString() + "'";
}
else if (objectValue is string)
{
value = "'" + ToJson(objectValue.ToString()) + "'";
}
else if (objectValue is IEnumerable)
{
value = ToJson((IEnumerable)objectValue);
}
else
{
value = ToJson(objectValue.ToString());
}
jsonString += "\"" + ToJson(propertyInfo[i].Name) + "\":" + value + ",";
}
jsonString.Remove(jsonString.Length - 1, jsonString.Length);
return jsonString + "}";
} #endregion #region Numeral Extension
/// <summary>
/// 是否在指定范围内
/// </summary>
/// <param name="start">起始数值</param>
/// <param name="end">结束数值</param>
public static bool Between(this decimal val, decimal start, decimal end)
{
return val >= start && val <= end;
}
/// <summary>
/// 是否在指定范围内
/// </summary>
/// <param name="start">起始数值</param>
/// <param name="end">结束数值</param>
public static bool Between(this int val, int start, int end)
{
return val >= start && val <= end;
}
/// <summary>
/// 是否在指定范围内
/// </summary>
/// <param name="start">起始数值</param>
/// <param name="end">结束数值</param>
public static bool Between(this float val, float start, float end)
{
return val >= start && val <= end;
}
/// <summary>
/// 是否在指定范围内
/// </summary>
/// <param name="start">起始数值</param>
/// <param name="end">结束数值</param>
public static bool Between(this double val, double start, double end)
{
return val >= start && val <= end;
} /// <summary>
/// 是否在指定范围内
/// </summary>
/// <param name="start">起始数值</param>
/// <param name="end">结束数值</param>
public static bool Between(this decimal? val, decimal start, decimal end)
{
return val.HasValue ? (val >= start && val <= end) : false;
}
/// <summary>
/// 是否在指定范围内
/// </summary>
/// <param name="start">起始数值</param>
/// <param name="end">结束数值</param>
public static bool Between(this int? val, int start, int end)
{
return val.HasValue ? (val >= start && val <= end) : false;
}
/// <summary>
/// 是否在指定范围内
/// </summary>
/// <param name="start">起始数值</param>
/// <param name="end">结束数值</param>
public static bool Between(this float? val, float start, float end)
{
return val.HasValue ? (val >= start && val <= end) : false;
}
/// <summary>
/// 是否在指定范围内
/// </summary>
/// <param name="start">起始数值</param>
/// <param name="end">结束数值</param>
public static bool Between(this double? val, double start, double end)
{
return val.HasValue ? (val >= start && val <= end) : false;
} #endregion #region Data Extension
/// <summary>
/// 通用简单实体类型互转
/// </summary>
public static List<ResultType> ConvertToEntityList<ResultType>(this object list) where ResultType : new()
{
List<ResultType> ResultList = new List<ResultType>();
if (list == null) return ResultList;
Type fromObj = list.GetType();
if (fromObj.Equals(typeof(DataTable)))
{
var dt = list as DataTable;
ResultList = dt.Rows.Cast<DataRow>().Where(m => !(m.RowState == DataRowState.Deleted || m.RowState == DataRowState.Detached)).Select(m => m.ConvertToEntityByDataRow<ResultType>()).ToList();
}
else if (list is IEnumerable)
{
ResultList = ((IList)list).Cast<object>().Select(m => m.ConvertToEntity<ResultType>()).ToList();
}
return ResultList;
} /// <summary>
/// 通用简单实体类型互转
/// </summary>
public static ResultType ConvertToEntity<ResultType>(this object fromEntity) where ResultType : new()
{
ResultType t = new ResultType();
Type fromObj = fromEntity.GetType();
if (fromObj.Equals(typeof(DataRow)))
{
//DataRow类型
DataRow dr = fromEntity as DataRow;
t = dr.ConvertToEntityByDataRow<ResultType>();
}
else
{
Type type = typeof(ResultType);
PropertyInfo[] properties = type.GetProperties();
PropertyInfo[] fromProperties = fromObj.GetProperties();
foreach (PropertyInfo pro in properties)
{
foreach (var fromPro in fromProperties)
{
if (fromPro.Name.Equals(pro.Name, StringComparison.OrdinalIgnoreCase))
{
object value = fromPro.GetValue(fromEntity, null);
if (value != null && value != DBNull.Value)
{
if (fromPro.PropertyType.Name != pro.PropertyType.Name)
{
if (pro.PropertyType.IsEnum)
{
pro.SetValue(t, Enum.Parse(pro.PropertyType, value.ToString()), null);
}
else
{
try
{
value = Convert.ChangeType
(
value,
(Nullable.GetUnderlyingType(pro.PropertyType) ?? pro.PropertyType)
);
pro.SetValue(t, value, null);
}
catch { }
}
}
else
{
pro.SetValue(t, value, null);
}
}
else
{
pro.SetValue(t, null, null);
}
break;
}
}
}
}
return t;
} /// <summary>
/// DataRow转换为实体类
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="dr"></param>
/// <returns></returns>
public static T ConvertToEntityByDataRow<T>(this DataRow dr) where T : new()
{
Type type = typeof(T);
PropertyInfo[] properties = type.GetProperties();
T t = new T();
if (dr == null) return t;
var columns = dr.Table.Columns.Cast<DataColumn>();
foreach (PropertyInfo pi in properties)
{
foreach (DataColumn column in dr.Table.Columns)
{
if (pi.Name.Equals(column.ColumnName, StringComparison.OrdinalIgnoreCase))
{
object value = dr[column];
if (value != null && value != DBNull.Value)
{
if (value.GetType().Name != pi.PropertyType.Name)
{
if (pi.PropertyType.IsEnum)
{
pi.SetValue(t, Enum.Parse(pi.PropertyType, value.ToString()), null);
}
else
{
try
{
value = Convert.ChangeType
(
value,
(Nullable.GetUnderlyingType(pi.PropertyType) ?? pi.PropertyType)
);
pi.SetValue(t, value, null);
}
catch { }
}
}
else
{
pi.SetValue(t, value, null);
}
}
else
{
pi.SetValue(t, null, null);
}
break;
}
}
}
return t;
} /// <summary>
/// 转换为DataTable,如果是集合没有数据行时候会抛异常。
/// </summary>
/// <param name="list"></param>
/// <returns></returns>
public static DataTable ConvertToDataTable(this object list)
{
if (list == null) return null;
DataTable dt = new DataTable();
if (list is IEnumerable)
{
var li = (IList)list;
//li[0]代表的是一个对象,list没有行时,会抛异常。
PropertyInfo[] properties = li[0].GetType().GetProperties();
dt.Columns.AddRange(properties.Where(m => !m.PropertyType.IsClass || !m.PropertyType.IsInterface).Select(m =>
new DataColumn(m.Name, Nullable.GetUnderlyingType(m.PropertyType) ?? m.PropertyType)).ToArray());
foreach (var item in li)
{
DataRow dr = dt.NewRow();
foreach (PropertyInfo pp in properties.Where(m => m.PropertyType.GetProperty("Item") == null)) //过滤含有索引器的属性
{
object value = pp.GetValue(item, null);
dr[pp.Name] = value == null ? DBNull.Value : value;
}
dt.Rows.Add(dr);
}
}
else
{
PropertyInfo[] properties = list.GetType().GetProperties();
properties = properties.Where(m => m.PropertyType.GetProperty("Item") == null).ToArray();//过滤含有索引器的属性
dt.Columns.AddRange(properties.Select(m =>
new DataColumn(m.Name, Nullable.GetUnderlyingType(m.PropertyType) ?? m.PropertyType)).ToArray());
DataRow dr = dt.NewRow();
foreach (PropertyInfo pp in properties)
{
object value = pp.GetValue(list, null);
dr[pp.Name] = value == null ? DBNull.Value : value;
}
dt.Rows.Add(dr);
}
return dt;
} /// <summary>
/// 转换为DataTable;如果list数据行为0,也不会抛异常,返回空行,是按照<T>进行转换。
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="list"></param>
/// <returns></returns>
public static DataTable ConvertToDataTable<T>(this object list) where T : new()
{
var dt = new DataTable();
if (list is IEnumerable)
{
IEnumerable<T> collection = (IEnumerable<T>)list;
var props = typeof(T).GetProperties();
dt.Columns.AddRange(props.Select(p => new DataColumn(p.Name, p.PropertyType)).ToArray());
if (collection.Count() > 0)
{
for (int i = 0; i < collection.Count(); i++)
{
ArrayList tempList = new ArrayList();
foreach (PropertyInfo pi in props)
{
object obj = pi.GetValue(collection.ElementAt(i), null);
tempList.Add(obj);
}
object[] array = tempList.ToArray();
dt.LoadDataRow(array, true);
}
}
}
return dt;
} /// <summary>
/// 实体类公共属性值复制
/// </summary>
/// <param name="entity"></param>
/// <param name="target"></param>
public static void CopyTo(this object entity, object target)
{
if (target == null) return;
if (entity.GetType() != target.GetType())
return;
PropertyInfo[] properties = target.GetType().GetProperties();
foreach (PropertyInfo pro in properties)
{
if (pro.PropertyType.GetProperty("Item") != null)
continue;
object value = pro.GetValue(entity, null);
if (value != null)
{
if (value is ICloneable)
{
pro.SetValue(target, (value as ICloneable).Clone(), null);
}
else
{
pro.SetValue(target, value.Copy(), null);
}
}
else
{
pro.SetValue(target, null, null);
}
}
} public static object Copy(this object obj)
{
if (obj == null) return null;
Object targetDeepCopyObj;
Type targetType = obj.GetType();
if (targetType.IsValueType == true)
{
targetDeepCopyObj = obj;
}
else
{
targetDeepCopyObj = System.Activator.CreateInstance(targetType); //创建引用对象
System.Reflection.MemberInfo[] memberCollection = obj.GetType().GetMembers(); foreach (System.Reflection.MemberInfo member in memberCollection)
{
if (member.GetType().GetProperty("Item") != null)
continue;
if (member.MemberType == System.Reflection.MemberTypes.Field)
{
System.Reflection.FieldInfo field = (System.Reflection.FieldInfo)member;
Object fieldValue = field.GetValue(obj);
if (fieldValue is ICloneable)
{
field.SetValue(targetDeepCopyObj, (fieldValue as ICloneable).Clone());
}
else
{
field.SetValue(targetDeepCopyObj, fieldValue.Copy());
}
}
else if (member.MemberType == System.Reflection.MemberTypes.Property)
{
System.Reflection.PropertyInfo myProperty = (System.Reflection.PropertyInfo)member;
MethodInfo info = myProperty.GetSetMethod(false);
if (info != null)
{
object propertyValue = myProperty.GetValue(obj, null);
if (propertyValue is ICloneable)
{
myProperty.SetValue(targetDeepCopyObj, (propertyValue as ICloneable).Clone(), null);
}
else
{
myProperty.SetValue(targetDeepCopyObj, propertyValue.Copy(), null);
}
}
}
}
}
return targetDeepCopyObj;
} #endregion public static T ChangeType<T>(this object obj, T t)
{
return (T)obj;
} public static string ConverToHTML(this DataTable dt)
{
System.Text.StringBuilder sb = new StringBuilder();
sb.AppendLine("<table style='font-size:12px;' border='1' cellspacing='0' cellpadding='3'>");
sb.Append(" <tr>");
foreach (DataColumn col in dt.Columns)
{
sb.Append(string.Format("<th>{0}</th>", col.ColumnName));
}
sb.AppendLine(" </tr>");
foreach (DataRow dr in dt.Rows)
{
sb.Append(" <tr>");
foreach (DataColumn col in dt.Columns)
{
sb.Append(string.Format("<td>{0}</td>", dr[col].ToString()));
}
sb.AppendLine(" </tr>");
}
sb.AppendLine("</table>");
return sb.ToString();
} }
}

.NET常用的扩展方法整理的更多相关文章

  1. ES6 对象定义简写及常用的扩展方法

    1.ES6 对象定义简写 es6提供了对象定义里的属性,方法简写方式: 假如属性和变量名一样,可以省略,包括定义对象方法function也可以省略 <script type="text ...

  2. Farseer.net轻量级开源框架 中级篇:常用的扩展方法

    导航 目   录:Farseer.net轻量级开源框架 目录 上一篇:Farseer.net轻量级开源框架 中级篇: BasePage.BaseController.BaseHandler.BaseM ...

  3. C# LiNq的语法以及常用的扩展方法

    首先先来扯一下,这篇博文是我第一次写的,主要是我的一些摘录,希望对大家有所帮助. Linq的基础 •LINQ(读音link):Linq To SQL(过时).Linq To Object.Linq T ...

  4. 用C#实现的几种常用数据校验方法整理(CRC校验;LRC校验;BCC校验;累加和校验)

    CRC即循环冗余校验码(Cyclic Redundancy Check):是数据通信领域中最常用的一种查错校验码,其特征是信息字段和校验字段的长度可以任意选定.循环冗余检查(CRC)是一种数据传输检错 ...

  5. 【EF学习笔记11】----------查询中常用的扩展方法

    先来看一下我们的表结构: 首先毫无疑问的要创建我们的上下文对象: using (var db = new Entities()) { //执行操作 } Average 平均值: //查询平均分 Con ...

  6. vim常用插件使用方法整理【持续更】

    nerdtree 和编辑文件一样,通过h j k l移动光标定位切换工作台和目录 ctr+w+h 光标focus左侧树形目录,ctrl+w+l 光标focus右侧文件显示窗口. ctrl+w+w,光标 ...

  7. .NET中那些所谓的新语法之二:匿名类、匿名方法与扩展方法

    开篇:在上一篇中,我们了解了自动属性.隐式类型.自动初始化器等所谓的新语法,这一篇我们继续征程,看看匿名类.匿名方法以及常用的扩展方法.虽然,都是很常见的东西,但是未必我们都明白其中蕴含的奥妙.所以, ...

  8. .Net 扩展方法集合.

      在项目中很多时候都会对字符串和集合做特定的处理.而且很多地方都会去调用.为了解决这些问题.我们通常会在项目中吧这些方法提成公共方法.下面是自己总结的项目中用到的一些扩展方法.封装成了一个Libra ...

  9. WebAPi添加常用扩展方法及思维发散

    前言 在WebAPi中我们通常需要得到请求信息中的查询字符串或者请求头中数据再或者是Cookie中的数据,如果需要大量获取,此时我们应该想到封装一个扩展类来添加扩展方法,从而实现简便快捷的获取. We ...

随机推荐

  1. 用Python高亮org-mode代码块

    文章同时可在我的github blog上阅读:http://cheukyin.github.io/python/2014-08/pygments-highlight-src-export-html.h ...

  2. 原型链和new

    http://www.cnblogs.com/objectorl/archive/2010/01/11/Object-instancof-Function-clarification.html 构造器 ...

  3. wordpress整站搬家总结

    去年图便宜,也没准备认真写博文,所以花了几百元钱买了个国内空间(域名已经备案).购买了以后,放了一个wordpress博客,没事的时候写写博文,但从没有抽出时间去写,文章的质量也不追求.一开始还可以, ...

  4. 关于本地计算机无法启动Apache2

    最近因工作需要,要学习PHP的基础编程,于是学习架设PHP工作环境. 但按照教材上介绍的那样,安装了WMAP后,一直无法运行成功.后发现Apache一直都不在运行状态.到WMAP中的Apache选项中 ...

  5. 使用$.getJSON实现跨域ajax请求

    jQuery中常用getJSON来调用并获取远程的JSON字符串,将其转换为JSON对象,如果成功,则执行回调函数.原型如下: jQuery.getJSON( url, [data], [callba ...

  6. 测试gcc的优化选项

    一.测试准备及原理 测试代码: static void wait(volatile unsigned long dly) { ; dly--); } int main(void) { unsigned ...

  7. EasyUI篇の日期控件

    页面代码: <input type="text" id='astartTime' class="easyui-datebox" style="w ...

  8. 字符串处理---统计每一行字符串当中的字符“u”个数

    package com.guoxiaoming.string; import java.io.BufferedReader; import java.io.FileInputStream; impor ...

  9. 【译】UI设计基础(UI Design Basics)--启动与停止(Starting and Stopping)(五)

    2.4  启动与停止(Starting and Stopping) 2.4.1  立即启动(Start Instantly) 通常来讲,用户不会花超过两分钟的时候去评价一个新的应用.在这段有限的时间里 ...

  10. angular2 学习笔记 (Pipes)

    Pipe 就是 ng1 的 filter <pre>{{ jsonValue | json }}</pre> 用法看这里就很清楚了 : https://angular.cn/d ...