C# Class Faker.Extensions.StringExtensions

A collection of string helper extensions.
Show file Open project: AdmiringWorm/Faker.NET.Portable

Public Methods

Method Description
AlphanumericOnly ( this s ) : string

Removes all characters which is not Alphanumeric from the specified source

Capitalise ( this s ) : string

Capitalizes the first letter of the given string.

Letterify ( this s ) : string

Get a string with every '?' replaced with a random character from the english alphabet.

Numerify ( this s ) : string

Get a string with every occurrence of '#' replaced with a random number.

Transform ( this s, bool replaceVariables = false ) : string

Transforms the specified source and conditionally replaces variables.

Private Methods

Method Description
AddVariables ( Type classType, IDictionary validVariables ) : void
FormatCulture ( [ format ) : string
FormatInvariant ( [ format ) : string
GetVariable ( string chars, int &index ) : string
GetVariableValue ( string chars, int &index ) : string
Numerify ( this s, bool replaceVariables ) : string

Transform the string replacing # placeholders into a number. Also replaces variables if replaceVariables is set to .

RemoveAccent ( string source ) : string
StringExtensions ( ) : System
Transform ( string s, bool letterify, bool numerify, bool replaceVariables ) : IEnumerable

Method Details

AlphanumericOnly() public static method

Removes all characters which is not Alphanumeric from the specified source
public static AlphanumericOnly ( this s ) : string
s this The source string.
return string

Capitalise() public static method

Capitalizes the first letter of the given string.
public static Capitalise ( this s ) : string
s this The source string.
return string

Letterify() public static method

Get a string with every '?' replaced with a random character from the english alphabet.
public static Letterify ( this s ) : string
s this The source format
return string

Numerify() public static method

Get a string with every occurrence of '#' replaced with a random number.
public static Numerify ( this s ) : string
s this The source format.
return string

Transform() public static method

Transforms the specified source and conditionally replaces variables.
public static Transform ( this s, bool replaceVariables = false ) : string
s this The s.
replaceVariables bool /// if set to replace variables in the string. ///
return string