快速将下划线字段改为驼峰字段

//ALTER TABLE `csp_server_order` MODIFY COLUMN `address` varchar(256) NULL COMMENT '详细地址';

            foreach (string s in lines)
            {
                Match fieldMatch = Regex.Match(s, @"COLUMN\s`(\w*)`", RegexOptions.IgnoreCase);
                if (fieldMatch.Success) {
                    string fieldName = fieldMatch.Groups[1].Value;
                    if (fieldName.Contains("_")) {

                        fieldName = Regex.Replace(fieldName,@"_(\w{1})",match=> match.Groups[1].Value.ToUpper());
                    }
                    list.Add(fieldName);
                }
            }
posted @ 2024-05-16 11:39  青山下  阅读(24)  评论(0编辑  收藏  举报