Skip to content
Snippets Groups Projects
Commit 0d1dcc9f authored by Andreas Traczyk's avatar Andreas Traczyk Committed by Adrien Béraud
Browse files

fallback avatar: fix getUpperInitial to skip spaces if any

Change-Id: I8446fc7a88c8c1b2a5a76cf6ad60f8fc8e784a4f
parent cef2cb62
No related branches found
No related tags found
No related merge requests found
...@@ -336,14 +336,17 @@ TrimCmd(Platform::String^ s) ...@@ -336,14 +336,17 @@ TrimCmd(Platform::String^ s)
String^ String^
getUpperInitial(String^ str) getUpperInitial(String^ str)
{ {
if (str != nullptr || str != "") { if (str == nullptr || str == "") {
std::wstring s(str->Data()); return "?";
}
auto it = str->Begin(); auto it = str->Begin();
wchar_t ch[] = L" "; wchar_t ch[] = L" ";
ch[0] = towupper(it[0]); int index = 0;
return ref new String(ch); ch[0] = towupper(*it++);
while (it != str->End() && ch[0] == ' ') {
ch[0] = towupper(*it++);
} }
return "?"; return ref new String(ch);
} }
Platform::String^ Platform::String^
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment