Updating RemoveUnwantedCharsFromString to be a template (#808)

This commit is contained in:
Scott Freeman
2019-11-18 22:02:45 -05:00
committed by Matt Cooley
parent 86307f206f
commit 582e10faed
3 changed files with 18 additions and 17 deletions

View File

@@ -379,7 +379,18 @@ namespace Utils
void IFTPlatformException(HRESULT hr);
Platform::String ^ GetStringValue(Platform::String ^ input);
bool IsLastCharacterTarget(std::wstring const& input, wchar_t target);
std::wstring RemoveUnwantedCharsFromString(std::wstring inputString, wchar_t* unwantedChars, unsigned int size);
// Return wstring after removing characters specified by unwantedChars array
template <size_t N>
std::wstring RemoveUnwantedCharsFromString(std::wstring inputString, const wchar_t (&unwantedChars)[N])
{
for (const wchar_t unwantedChar : unwantedChars)
{
inputString.erase(std::remove(inputString.begin(), inputString.end(), unwantedChar), inputString.end());
}
return inputString;
}
double GetDoubleFromWstring(std::wstring input);
int GetWindowId();
void RunOnUIThreadNonblocking(std::function<void()>&& function, _In_ Windows::UI::Core::CoreDispatcher ^ currentDispatcher);