<commit_before>// Author: http://lemming.life
// Language: C#
// Purpose: Given a url extract the protocol, domain, and query string. 
// Date: July 15, 2017

using System;

namespace Snippets {
    class UrlParser {

        static string getProtocol(string url) {
            string lookFor = "://";
            int indexOf = url.IndexOf(lookFor);
            return url.Substring(0, indexOf);
        }

        static string getDomain(string url) {
            string lookFor1 = "://";
            string lookFor2 = "/";
            int indexOf1 = url.IndexOf(lookFor1) + lookFor1.Length;
            url = url.Substring(indexOf1, url.Length - indexOf1);
            int indexOf2 = url.IndexOf(lookFor2);
            return url.Substring(0, indexOf2);
        }

        static string getQuery(string url) {
            string lookFor = "/";
            int indexOf = url.LastIndexOf(lookFor) + 1;
            return url.Substring(indexOf, url.Length - indexOf);
        }

        public static void executeDriver() {
            string url = "http://google.com/theQuery123";
            Console.WriteLine("Url1 is: " + url);
            Console.WriteLine("Protocol: " + getProtocol(url));
            Console.WriteLine("Domain: " + getDomain(url));
            Console.WriteLine("Query: " + getQuery(url));

            url = "http://google.com/some/stuff/in/between/theQuery123";
            Console.WriteLine("\nUrl2 is: " + url);
            Console.WriteLine("Protocol: " + getProtocol(url));
            Console.WriteLine("Domain: " + getDomain(url));
            Console.WriteLine("Query: " + getQuery(url));
        }


    }
}
<commit_msg>Added parseUrl.cs<commit_after>// Author: http://lemming.life
// Language: C#
// Purpose: Given a url extract the protocol, domain, and query string. 
// Date: July 15, 2017

using System;

namespace Snippets {
    class UrlParser {

        static string getProtocol(string url) {
            string lookFor = "://";
            int indexOf = url.IndexOf(lookFor);
            return url.Substring(0, indexOf);
        }

        static string getDomain(string url) {
            string lookFor1 = "://";
            string lookFor2 = "/";
            int indexOf1 = url.IndexOf(lookFor1) + lookFor1.Length;
            url = url.Substring(indexOf1, url.Length - indexOf1);
            int indexOf2 = url.IndexOf(lookFor2);
            return url.Substring(0, indexOf2);
        }

        static string getQuery(string url) {
            string lookFor = "/";
            int indexOf = url.LastIndexOf(lookFor) + 1;
            return url.Substring(indexOf, url.Length - indexOf);
        }

        public static void executeDriver() {
            string url = "http://google.com/theQuery123";
            Console.WriteLine("Url1 is: " + url);
            Console.WriteLine("Protocol: " + getProtocol(url));
            Console.WriteLine("Domain: " + getDomain(url));
            Console.WriteLine("Query: " + getQuery(url));

            url = "http://google.com/some/stuff/in/between/theQuery123";
            Console.WriteLine("\nUrl2 is: " + url);
            Console.WriteLine("Protocol: " + getProtocol(url));
            Console.WriteLine("Domain: " + getDomain(url));
            Console.WriteLine("Query: " + getQuery(url));
        }
        
    }
}

{'fraction_non_alphanumeric': 0.1305396442568586, 'fraction_numerical': 0.016279770877298764, 'mean_word_length': 1.9945848375451263, 'pattern_counts': {'":': 4, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5855672', 'n_tokens_mistral': 959, 'n_tokens_neox': 920, 'n_words': 203}