<commit_before>﻿using System;
using System.Net;
using System.Text;

namespace Flashback.Services
{
    public static class StringExtensions
    {        
        public static string FixaRadbrytningar(this String str)
        {
            return string.IsNullOrWhiteSpace(str) ? str : str.Replace("&nbsp;", "").Replace("\t", "").Replace("\n", "");
        }

        public static string FixLeaveLink(this String str)
        {
            if (string.IsNullOrWhiteSpace(str))
            {
                return str;
            }
            else
            {
                str = str.Replace("/leave.php?u=", "");

                return str;
            }
        }

        public static string GetCleanId(this String str, bool removeForumAndThreadIndicator)
        {
            if (string.IsNullOrWhiteSpace(str))
            {
                return str;
            }
            else
            {
                str = str.GetCleanIdFirstPage().Replace("p1", "");

                if (removeForumAndThreadIndicator)
                    str = str.Replace("f", "").Replace("t", "");

                return str;
            }
        }

        public static string GetCleanIdForPage(this String str, int pageNumber)
        {
            if (string.IsNullOrWhiteSpace(str))
            {
                return str;
            }
            else
            {
                str = str.GetCleanId(false) + "p" + pageNumber;

                return str;                
            }
        }

        public static string GetCleanIdFirstPage(this String str)
        {
            if (string.IsNullOrWhiteSpace(str))
                return str;
            else
            {                                
                str = str.Replace("s", "");
                str = str + "p1";

                int posP = str.IndexOf("p", System.StringComparison.Ordinal);
                if (posP != -1)
                {
                    str = str.Substring(0, posP) + "p1";
                }

                return str;
            }
        }
<commit_msg>Update StringExtensions.cs (#92)<commit_after>using System;
using System.Net;
using System.Text;

namespace Flashback.Services
{
    public static class StringExtensions
    {        
        public static string FixaRadbrytningar(this String str)
        {
            return string.IsNullOrWhiteSpace(str) ? str : str.Replace("&nbsp;", "").Replace("\t", "").Replace("\n", "");
        }

        public static string FixLeaveLink(this String str)
        {
            return string.IsNullOrWhiteSpace(str) ? str : str.Replace("/leave.php?u=", "");
        }

        public static string GetCleanId(this String str, bool removeForumAndThreadIndicator)
        {
            if (string.IsNullOrWhiteSpace(str))
            {
                return str;
            }
            else
            {
                str = str.GetCleanIdFirstPage().Replace("p1", "");

                if (removeForumAndThreadIndicator)
                    str = str.Replace("f", "").Replace("t", "");

                return str;
            }
        }

        public static string GetCleanIdForPage(this String str, int pageNumber)
        {
            return string.IsNullOrWhiteSpace(str) ? str : str.GetCleanId(false) + "p" + pageNumber;
        }

        public static string GetCleanIdFirstPage(this String str)
        {
            if (string.IsNullOrWhiteSpace(str))
                return str;
            else
            {                                
                str = str.Replace("s", "");
                str = str + "p1";

                int posP = str.IndexOf("p", System.StringComparison.Ordinal);
                if (posP != -1)
                {
                    str = str.Substring(0, posP) + "p1";
                }

                return str;
            }
        }

{'fraction_non_alphanumeric': 0.10440414507772021, 'fraction_numerical': 0.0031088082901554403, 'mean_word_length': 1.244767441860465, 'pattern_counts': {'":': 0, '<': 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': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2476995', 'n_tokens_mistral': 1016, 'n_tokens_neox': 984, 'n_words': 210}