fix: repair of small humps

dev_without_third_libraries
DESKTOP-3BO4HSG\ksat 2 years ago
parent 6e6c1ee2e5
commit cb0ec990ab

@ -109,6 +109,9 @@ namespace STranslate.ViewModel
} }
OutputTxt = translateResp; OutputTxt = translateResp;
//如果不是英文则不进行转换
if (LanguageEnumDict[OutputComboSelected] != LanguageEnum.EN) return;
var splitList = OutputTxt.Split(' ').ToList(); var splitList = OutputTxt.Split(' ').ToList();
if (splitList.Count > 1) if (splitList.Count > 1)
{ {
@ -116,6 +119,7 @@ namespace STranslate.ViewModel
SmallHumpRet = GenHumpString(splitList, true); //小驼峰 SmallHumpRet = GenHumpString(splitList, true); //小驼峰
LargeHumpRet = GenHumpString(splitList, false); //大驼峰 LargeHumpRet = GenHumpString(splitList, false); //大驼峰
} }
//System.Diagnostics.Debug.Print(SnakeRet + "\n" + SmallHumpRet + "\n" + LargeHumpRet);
} }
catch (Exception ex) catch (Exception ex)
{ {
@ -153,7 +157,7 @@ namespace STranslate.ViewModel
{ {
char[] chars = array[j].ToCharArray(); char[] chars = array[j].ToCharArray();
if (j == 0 && isSmallHump) chars[0] = char.ToLower(chars[0]); if (j == 0 && isSmallHump) chars[0] = char.ToLower(chars[0]);
chars[0] = char.ToUpper(chars[0]); else chars[0] = char.ToUpper(chars[0]);
for (int i = 1; i < chars.Length; i++) for (int i = 1; i < chars.Length; i++)
{ {
chars[i] = char.ToLower(chars[i]); chars[i] = char.ToLower(chars[i]);

Loading…
Cancel
Save