aboutsummaryrefslogtreecommitdiff
path: root/lib/common.vala
blob: 2c197c7bb10e462fa9074e5c480d00aff9b0e3f6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
string get_abbreviation (string name) {
	var index = 0;
	unichar first;
	unichar second;

	if (name.get_next_char (ref index, out first)) {
		if (name.get_next_char (ref index, out second)) {
			return @"$((!) first.toupper ().to_string ())$((!) second.to_string ())";
		} else {
			return (!) first.toupper ().to_string ();
		}
	} else {
		return "";
	}
}