• c#实现数据的左补右补功能


           /// <summary>
            /// 左補右補功能
            /// </summary>
            /// <param name="str">待處理字符串</param>
            /// <param name="expad_type">待補類型(L:左補,R:右補)</param>
            /// <param name="conLength">總長度</param>
            /// <param name="PadChar">補滿內容</param>
            private static void StrPadding(ref string str, string expad_type, int conLength, char PadChar)
            {
                if (str.Length >= conLength)
                {
                    str = str.Substring(0, conLength);
                }
                else
                {
                    if (expad_type.ToUpper() == "L")
                    {
                        str = str.PadLeft(conLength, PadChar);
                    }
                    else
                    {
                        str = str.PadRight(conLength, PadChar);
                    }
                }
            }
         

  • 相关阅读:
    javac 命令行使用总结
    电脑右键菜单的编辑(注册表操作)
    C++ —— 类模板的分离式编译
    命令行学习备份
    浏览器老是自动跳出广告垃圾网页
    SQL 事务
    Python中MySQL插入数据
    Python给数字前固定位数加零
    selenium+python3 鼠标事件
    mysql与mongodb命令对比
  • 原文地址:https://www.cnblogs.com/xiatianoo/p/4790788.html
Copyright © 2020-2023  润新知