快速將下劃線欄位改為駝峰欄位

青山下發表於2024-05-16
//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);
}
}

相關文章