P2PStateServer.ServiceMessage.GetKeyValue C# (CSharp) 메소드

GetKeyValue() 보호된 정적인 메소드

Parses a string for a Key and a Value
protected static GetKeyValue ( string Text, char Delimiter, string &Key, string &Value ) : void
Text string The text to parse
Delimiter char Delimiter seperating key and value
Key string Key
Value string Value
리턴 void
        protected static void GetKeyValue(string Text, char Delimiter, out string Key, out string Value)
        {
            if (Text == null) throw new ArgumentNullException("Text");

            int index = Text.IndexOf(Delimiter);

            if (index < 1)
            {
                Key = Text;
                Value = string.Empty;
                return;
            }

            Key = Text.Substring(0, index);
            if (Key.Length == Text.Length)
            {
                Value = string.Empty;
            }
            else
            {
                Value = Text.Substring(index + 1);
            }
        }