mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-12-16 11:48:06 +01:00
[PTRun][UnitConverter]Accept kilometers per hour abbreviations (#33594)
## Summary of the Pull Request This PR introduces abbreviations for the units - `kph` that gets converted to `km/h` and `cph` that gets converted to `cm/h`.
This commit is contained in:
3
.github/actions/spell-check/expect.txt
vendored
3
.github/actions/spell-check/expect.txt
vendored
@@ -200,6 +200,7 @@ CMINVOKECOMMANDINFO
|
|||||||
CMINVOKECOMMANDINFOEX
|
CMINVOKECOMMANDINFOEX
|
||||||
CMock
|
CMock
|
||||||
CMONITORS
|
CMONITORS
|
||||||
|
cmph
|
||||||
cmpgt
|
cmpgt
|
||||||
cne
|
cne
|
||||||
CNF
|
CNF
|
||||||
@@ -244,6 +245,7 @@ copiedcolorrepresentation
|
|||||||
cotaskmem
|
cotaskmem
|
||||||
COULDNOT
|
COULDNOT
|
||||||
countof
|
countof
|
||||||
|
cph
|
||||||
CPower
|
CPower
|
||||||
cppblog
|
cppblog
|
||||||
cppruntime
|
cppruntime
|
||||||
@@ -760,6 +762,7 @@ keyremaps
|
|||||||
keyvault
|
keyvault
|
||||||
KILLFOCUS
|
KILLFOCUS
|
||||||
killrunner
|
killrunner
|
||||||
|
kmph
|
||||||
Knownfolders
|
Knownfolders
|
||||||
ksh
|
ksh
|
||||||
KSPROPERTY
|
KSPROPERTY
|
||||||
|
|||||||
@@ -179,6 +179,22 @@ namespace Community.PowerToys.Run.Plugin.UnitConverter
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Converts spelling "kph" to "km/h"
|
||||||
|
/// </summary>
|
||||||
|
public static void KPHHandler(ref string[] split)
|
||||||
|
{
|
||||||
|
split[1] = split[1].Replace("cph", "cm/h", System.StringComparison.CurrentCultureIgnoreCase);
|
||||||
|
split[1] = split[1].Replace("kph", "km/h", System.StringComparison.CurrentCultureIgnoreCase);
|
||||||
|
split[1] = split[1].Replace("kmph", "km/h", System.StringComparison.CurrentCultureIgnoreCase);
|
||||||
|
split[1] = split[1].Replace("cmph", "cm/h", System.StringComparison.CurrentCultureIgnoreCase);
|
||||||
|
|
||||||
|
split[3] = split[3].Replace("cph", "cm/h", System.StringComparison.CurrentCultureIgnoreCase);
|
||||||
|
split[3] = split[3].Replace("kph", "km/h", System.StringComparison.CurrentCultureIgnoreCase);
|
||||||
|
split[3] = split[3].Replace("kmph", "km/h", System.StringComparison.CurrentCultureIgnoreCase);
|
||||||
|
split[3] = split[3].Replace("cmph", "cm/h", System.StringComparison.CurrentCultureIgnoreCase);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Converts spelling "metre" to "meter", also for centimetre and other variants
|
/// Converts spelling "metre" to "meter", also for centimetre and other variants
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -239,6 +255,7 @@ namespace Community.PowerToys.Run.Plugin.UnitConverter
|
|||||||
InputInterpreter.DegreePrefixer(ref split);
|
InputInterpreter.DegreePrefixer(ref split);
|
||||||
InputInterpreter.MetreToMeter(ref split);
|
InputInterpreter.MetreToMeter(ref split);
|
||||||
InputInterpreter.FeetToFt(ref split);
|
InputInterpreter.FeetToFt(ref split);
|
||||||
|
InputInterpreter.KPHHandler(ref split);
|
||||||
InputInterpreter.GallonHandler(ref split, CultureInfo.CurrentCulture);
|
InputInterpreter.GallonHandler(ref split, CultureInfo.CurrentCulture);
|
||||||
if (!double.TryParse(split[0], out double value))
|
if (!double.TryParse(split[0], out double value))
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user