Exemplo n.º 1
0
    // Token: 0x06002EC7 RID: 11975 RVA: 0x000B419C File Offset: 0x000B239C
    public static string RemoveWhiteSpaces(this string s)
    {
        int num = (s != null) ? s.Length : 0;

        for (int i = 0; i < num; i++)
        {
            if (char.IsWhiteSpace(s[i]))
            {
                if (i == num - 1)
                {
                    return(s.Remove(num - 1));
                }
                char[] array;
                using (global::StringEx.L l = global::StringEx.S(s, num, out array))
                {
                    if (!l.V)
                    {
                        return(s);
                    }
                    int l2 = i;
                    while (++i < num)
                    {
                        if (!char.IsWhiteSpace(array[i]))
                        {
                            array[l2++] = array[i];
                        }
                    }
                    return(global::StringEx.c2s(array, l2));
                }
            }
        }
        return(s);
    }
Exemplo n.º 2
0
    // Token: 0x06002EC9 RID: 11977 RVA: 0x000B4330 File Offset: 0x000B2530
    public static string ToUpperEx(this string s)
    {
        int num = (s != null) ? s.Length : 0;

        for (int i = 0; i < num; i++)
        {
            if (char.IsLower(s, i))
            {
                char[] array;
                using (global::StringEx.L l = global::StringEx.S(s, num, out array))
                {
                    if (!l.V)
                    {
                        return(s);
                    }
                    do
                    {
                        array[i] = char.ToUpperInvariant(array[i]);
                    }while (++i < num);
                    return(global::StringEx.c2s(array, num));
                }
            }
        }
        return(s);
    }
Exemplo n.º 3
0
    // Token: 0x06002ECC RID: 11980 RVA: 0x000B4604 File Offset: 0x000B2804
    public static string RemoveChars(this string s, params char[] rem)
    {
        int num = rem.Length;

        if (num == 0)
        {
            return(s);
        }
        int num2 = (s != null) ? s.Length : 0;

        for (int i = 0; i < num2; i++)
        {
            for (int j = 0; j < num; j++)
            {
                if (s[i] == rem[j])
                {
                    if (i == num2 - 1)
                    {
                        return(s.Remove(num2 - 1));
                    }
                    char[] array;
                    using (global::StringEx.L l = global::StringEx.S(s, num2, out array))
                    {
                        if (!l.V)
                        {
                            return(s);
                        }
                        int l2 = i;
                        while (++i < num2)
                        {
                            for (j = 0; j < num; j++)
                            {
                                if (rem[j] == array[i])
                                {
                                }
                            }
                            array[l2++] = array[i];
                        }
                        return(global::StringEx.c2s(array, l2));
                    }
                }
            }
        }
        return(s);
    }
Exemplo n.º 4
0
 // Token: 0x06002EC3 RID: 11971 RVA: 0x000B4094 File Offset: 0x000B2294
 private static global::StringEx.L S(string s, int l, out char[] buffer)
 {
     if (s == null || l <= 0)
     {
         buffer = null;
         return(default(global::StringEx.L));
     }
     global::StringEx.L result = new global::StringEx.L(l <= 1024);
     if (result.locked)
     {
         int    sourceIndex = 0;
         char[] destination;
         buffer = (destination = global::StringEx.cb);
         s.CopyTo(sourceIndex, destination, 0, l);
     }
     else
     {
         buffer = s.ToCharArray();
     }
     return(result);
 }
Exemplo n.º 5
0
    // Token: 0x06002ECA RID: 11978 RVA: 0x000B43E4 File Offset: 0x000B25E4
    public static string MakeNice(this string s)
    {
        int length;

        if (s != null && (length = s.Length) > 1)
        {
            int num = -1;
            while (++num < length)
            {
                if (char.IsLetterOrDigit(s, num))
                {
                    if (num == length - 1)
                    {
                        return(s.Substring(length - 1, 1));
                    }
                    bool   flag  = char.IsDigit(s, num);
                    bool   flag2 = true;
                    bool   flag3 = true;
                    int    num2  = 0;
                    char[] array;
                    using (global::StringEx.L l = global::StringEx.S(s, length - num, (length - (num + 1)) * 2, out array))
                    {
                        if (!l.V)
                        {
                            return(s);
                        }
                        if (!flag)
                        {
                            array[num2++] = char.ToUpper(s[num]);
                        }
                        else
                        {
                            array[num2++] = s[num];
                        }
                        while (++num < length)
                        {
                            if (flag != char.IsNumber(s, num))
                            {
                                flag = !flag;
                                if (!flag3)
                                {
                                    array[num2++] = ' ';
                                }
                                else
                                {
                                    flag3 = false;
                                }
                                array[num2++] = ((!flag) ? char.ToUpperInvariant(s[num]) : s[num]);
                                flag2         = true;
                            }
                            else if (flag)
                            {
                                array[num2++] = s[num];
                            }
                            else if (char.IsUpper(s, num))
                            {
                                if (!flag2)
                                {
                                    if (!flag3)
                                    {
                                        array[num2++] = ' ';
                                    }
                                    else
                                    {
                                        flag3 = false;
                                    }
                                    flag2 = true;
                                }
                                array[num2++] = s[num];
                            }
                            else if (char.IsLower(s, num))
                            {
                                array[num2++] = s[num];
                                flag2         = false;
                            }
                            else if (!flag3)
                            {
                                array[num2++] = ' ';
                                flag3         = true;
                            }
                        }
                        return(global::StringEx.c2s(array, (!flag3) ? num2 : (num2 - 1)));
                    }
                    continue;
                }
            }
            return(string.Empty);
        }
        return(s);
    }