SIL.FieldWorks.UnicodeCharEditor.PUAInstaller.GetProperty C# (CSharp) Method

GetProperty() public static method

Reads the Property value from the given line of a UCD text file. (For example, if the text file is DerivedBidiClass.txt, this reads the bidi class value from the given line of a DerivedBidiClass.txt file.)
public static GetProperty ( string line ) : string
line string A line from a UCD file in the following format: /// code;Property[; other] [ # other]
return string
		public static string GetProperty(string line)
		{
			// (Note, by doing it in two steps, we are assured that even in strange cases like:
			//	code ; property # comment ; comment
			// it will stll work

			// Grab from the ; to the #, or the end of the line
			//If a comment is not on the line
			var propertyWithValue = line.IndexOf('#') == -1 ?
				line.Substring(line.IndexOf(';') + 1).Trim() :
				line.Substring(line.IndexOf(';') + 1, line.IndexOf('#') - line.IndexOf(';') - 1).Trim();

			// Return only from the first ';' to the second ';'
			return propertyWithValue.IndexOf(';') != -1 ?
				propertyWithValue.Substring(0, propertyWithValue.IndexOf(';')).Trim() :
				propertyWithValue;
		}