Skip to content
This repository has been archived by the owner on Apr 18, 2024. It is now read-only.

StringExtentions

Stone_Red edited this page May 10, 2021 · 3 revisions

Stone_Red_Utilities.StringExtentions

Methods

  • EqualsIgnoreCase

    • Description: Determines whether this instance and another specified string object have the same value regardless of upper and lower case.

    • Parameters: this string str, string value

    • Example usage:

      string str1 = "BIG";
      string str2 = "big";
      
      bool match = str1.EqualsIgnoreCase(str2);
      
      Console.WriteLine(match);
    • Output:

      True
      
  • EqualsIgnoreSpaces

    • Description: Determines whether this instance and another specified string object have the same value regardless of spaces.

    • Parameters: this string str, string value

    • Example usage:

      string str1 = "space";
      string str2 = " s p a c e ";
      
      bool match = str1.EqualsIgnoreSpaces(str2);
      
      Console.WriteLine(match);
    • Output:

      True
      
  • EqualsIgnoreSpacesAndCase

    • Description: Determines whether this instance and another specified string object have the same value regardless of upper and lower case and spaces.

    • Parameters: this string str, string value

    • Example usage:

      string str1 = "BIG space";
      string str2 = "big s p a c e ";
      
      bool match = str1.EqualsIgnoreSpacesAndCase(str2);
      
      Console.WriteLine(match);
    • Output:

      True
      
  • ToFileName

    • Description: Determines whether this instance and another specified string object have the same value regardless of upper and lower case and spaces.

    • Parameters: this string str, string value

    • Example usage:

      string str = "*n*/ /äme";
      string fileName = str.ToFileName();
      Console.WriteLine(fileName);
    • Output:

      name
      
  • ToPath

    • Description: Determines whether this instance and another specified string object have the same value regardless of upper and lower case and spaces.

    • Parameters: this string str, string value

    • Example usage:

      string str = "C://goöd   /päth";
      string fileName = str.ToPath();
      Console.WriteLine(fileName);
    • Output:

      C://good/path
      
  • RemoveWhitespaces

    • Description: Revoves all whitespaces from the specified string

    • Parameters: this string str

    • Example usage:

      string str = "a b c";
      string result = str.RemoveWhitespaces();
      Console.WriteLine(result);
    • Output:

      abc
      
  • Reverse

    • Description: Reverses the specified string

    • Parameters: this string str

    • Example usage:

      string str = "em esrever";
      Console.WriteLine(str.Reverse());
    • Output:

      reverse me