将字符串改为小驼峰格式
方法一:PYCHARM
将字符串改为小驼峰格式
import re
a='INDEX_ABROAD_MARKET_MKT_DETAIL_LIST'
a=a.lower()#index_abroad_market_mkt_detail_list
print(re.sub(r"_(\w)",lambda match:match.group(1).upper(),a))
打印结果:
indexAbroadMarketMktDetailList
----------
方法二:server sql
declare @gao varchar(500),@tmp int ,@i int =0
set @gao=Lower('INDEX_ABROAD_MARKET_MKT_DETAIL_LIST')
while CHARINDEX('_', @gao)>0
begin
set @i=@i+1
set @tmp= CHARINDEX('_',@gao)
set @gao=left(@gao,@tmp-1)+UPPER(substring(@gao,@tmp+1,1))+right(@gao,(len(@gao)-@tmp-1))
end
select @gao
---indexAbroadMarketMktDetailList
--批量改
import re
a=[
'fin_all_detail_list_quar',
'fin_all_detail_list_1quar',
'fin_all_detail_list_2quar'
]
for i in a :
#a=a.lower()#index_abroad_market_mkt_detail_list
print(re.sub(r"_(\w)",lambda match:match.group(1).upper(),i))
方法三:
ULtraEdit-32 编辑器 -F5 首字母大写
参考网址:
https://www.cnpython.com/qa/39992