badge - refactor (forgot a ToUpper for 1 of the return paths
This commit is contained in:
1 parent
a82a22b133
commit
47c827caf6
1 file changed
+5
-4
@@ -133,21 +133,22 @@ namespace mbts.spark {
|
||||
|
||||
string _generate_abbreviation_for_algo_studio_algo(AlgoData? a) {
|
||||
char[] delim = { ' ' };
|
||||
string candidate = string.Empty;
|
||||
if (a.HasValue) {
|
||||
var algo_name = a.Value.name;
|
||||
var words = algo_name.Split(delim);
|
||||
if (words.Length == 1) {
|
||||
var single_word = words[0];
|
||||
if (single_word.Length > 1) {
|
||||
return words[0].Substring(0, 2).ToUpper();
|
||||
candidate = words[0].Substring(0, 2);
|
||||
} else {
|
||||
return single_word;
|
||||
candidate = single_word;
|
||||
}
|
||||
} else {
|
||||
return words.Take(2).Select(w => w.Substring(0, 1)).list_string(string.Empty).ToUpper();
|
||||
candidate = words.Take(2).Select(w => w.Substring(0, 1)).list_string(string.Empty);
|
||||
}
|
||||
}
|
||||
return string.Empty;
|
||||
return candidate.ToUpper();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user