Show / Hide Table of Contents

Class StringExtensions

Extension methods for System.String.

Inheritance
System.Object
StringExtensions
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Microsoft.GNS.Utilities.Extensions
Assembly: Gns.Utilities.dll
Syntax
public static class StringExtensions

Methods

View Source

IsSafeForFileName(String)

Determines if a string is safe for use as a file name.

Declaration
public static bool IsSafeForFileName(this string self)
Parameters
Type Name Description
System.String self

The string being extended.

Returns
Type Description
System.Boolean

Whether or not the string is safe to use as a file name.

View Source

ToFileName(String, String)

Gets a string safe for use as a file name.

Declaration
public static string ToFileName(this string self, string replace = null)
Parameters
Type Name Description
System.String self

The string being extended.

System.String replace

An optional string to replace unsafe characters with.

Returns
Type Description
System.String

The string which is safe to use as a file name.

View Source

ToSentenceCase(String, CultureInfo)

Converts the string to sentence case by lowercasing capital letters and adding a space.

Declaration
public static string ToSentenceCase(this string input, CultureInfo culture)
Parameters
Type Name Description
System.String input

The input string.

System.Globalization.CultureInfo culture

An object that supplies culture-specific casing rules.

Returns
Type Description
System.String

The sentence cased string.

  • View Source
In This Article
Back to top Generated by DocFX