| 12345678910111213141516171819202122232425262728293031323334353637383940 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace ivf_tl_Entity.ComEntitys
- {
- public class StringHelper
- {
- /// <summary>
- /// 字节数组转16进制字符串
- /// </summary>
- /// <param name="bytes"></param>
- /// <returns></returns>
- public static string ByteToHexStr(byte[] bytes)
- {
- string returnStr = "";
- if (bytes != null)
- {
- for (int i = 0; i < bytes.Length; i++)
- {
- returnStr += bytes[i].ToString("X2") + " ";
- }
- }
- return returnStr;
- }
- /// <summary>
- /// 时:分:秒.毫秒
- /// </summary>
- /// <param name="obj"></param>
- /// <returns></returns>
- public static string TimeToString(TimeSpan obj)
- {
- string totalTimeStr = String.Format("{0:00}:{1:00}:{2:00}.{3:00}", obj.Hours, obj.Minutes, obj.Seconds, obj.Milliseconds / 10);
- return totalTimeStr;
- }
- }
- }
|