C# Class DotLiquid.StandardFilters

Exibir arquivo Open project: dotliquid/dotliquid Class Usage Examples

Public Methods

Method Description
Append ( string input, string @string ) : string

Add one string to another

Capitalize ( string input ) : string

capitalize words in the input sentence

Date ( object input, string format ) : string

Formats a date using a .NET date format string

Default ( string input, string @defaultValue ) : string

If a value isn't set for a variable in the template, allow the user to specify a default value for that variable

DividedBy ( object input, object operand ) : object

Division

Downcase ( string input ) : string

convert a input string to DOWNCASE

Escape ( string input ) : string
First ( IEnumerable array ) : object

Get the first element of the passed in array Example: {{ product.images | first | to_img }}

H ( string input ) : string
Join ( IEnumerable input ) : string

Join elements of the array with a certain character between them

Join ( IEnumerable input, string glue ) : string

Join elements of the array with a certain character between them

Last ( IEnumerable array ) : object

Get the last element of the passed in array Example: {{ product.images | last | to_img }}

Map ( IEnumerable input, string property ) : IEnumerable

Map/collect on a given property

Minus ( object input, object operand ) : object

Subtraction

Modulo ( object input, object operand ) : object
NewlineToBr ( string input ) : string

Add
tags in front of all newlines in input string

Plus ( object input, object operand ) : object

Addition

Prepend ( string input, string @string ) : string

Prepend a string to another

Remove ( string input, string @string ) : string

Remove a substring

RemoveFirst ( string input, string @string ) : string

Remove the first occurrence of a substring

Replace ( string input, string @string ) : string

Replace occurrences of a string with another

Replace ( string input, string @string, string replacement ) : string

Replace occurrences of a string with another

ReplaceFirst ( string input, string @string ) : string

Replace the first occurence of a string with another

ReplaceFirst ( string input, string @string, string replacement ) : string

Replace the first occurence of a string with another

Round ( object input, object places = null ) : object
Size ( object input ) : int

Return the size of an array or of an string

Slice ( string input, int start, int len = 1 ) : string

Return a Part of a String

Sort ( object input ) : IEnumerable

Sort elements of the array provide optional property with which to sort an array of hashes or drops

Sort ( object input, string property ) : IEnumerable

Sort elements of the array provide optional property with which to sort an array of hashes or drops

Split ( string input, string pattern ) : string[]

Split input string into an array of substrings separated by given pattern.

StripHtml ( string input ) : string
StripNewlines ( string input ) : string

Remove all newlines from the string

Times ( object input, object operand ) : object

Multiplication

Truncate ( string input ) : string

Truncates a string down to 15 characters

Truncate ( string input, int length ) : string

Truncates a string down to length characters

Truncate ( string input, int length, string truncateString ) : string

Truncates a string down to x characters

TruncateWords ( string input ) : string
TruncateWords ( string input, int words ) : string
TruncateWords ( string input, int words, string truncateString ) : string
Upcase ( string input ) : string

convert a input string to UPCASE

UrlEncode ( string input ) : string

convert a input string to URLENCODE

Private Methods

Method Description
DoMathsOperation ( object input, object operand, Func operation ) : object
IsReal ( object o ) : bool

Method Details

Append() public static method

Add one string to another
public static Append ( string input, string @string ) : string
input string
@string string
return string

Capitalize() public static method

capitalize words in the input sentence
public static Capitalize ( string input ) : string
input string
return string

Date() public static method

Formats a date using a .NET date format string
public static Date ( object input, string format ) : string
input object
format string
return string

Default() public static method

If a value isn't set for a variable in the template, allow the user to specify a default value for that variable
public static Default ( string input, string @defaultValue ) : string
input string
@defaultValue string
return string

DividedBy() public static method

Division
public static DividedBy ( object input, object operand ) : object
input object
operand object
return object

Downcase() public static method

convert a input string to DOWNCASE
public static Downcase ( string input ) : string
input string
return string

Escape() public static method

public static Escape ( string input ) : string
input string
return string

First() public static method

Get the first element of the passed in array Example: {{ product.images | first | to_img }}
public static First ( IEnumerable array ) : object
array IEnumerable
return object

H() public static method

public static H ( string input ) : string
input string
return string

Join() public static method

Join elements of the array with a certain character between them
public static Join ( IEnumerable input ) : string
input IEnumerable
return string

Join() public static method

Join elements of the array with a certain character between them
public static Join ( IEnumerable input, string glue ) : string
input IEnumerable
glue string
return string

Last() public static method

Get the last element of the passed in array Example: {{ product.images | last | to_img }}
public static Last ( IEnumerable array ) : object
array IEnumerable
return object

Map() public static method

Map/collect on a given property
public static Map ( IEnumerable input, string property ) : IEnumerable
input IEnumerable
property string
return IEnumerable

Minus() public static method

Subtraction
public static Minus ( object input, object operand ) : object
input object
operand object
return object

Modulo() public static method

public static Modulo ( object input, object operand ) : object
input object
operand object
return object

NewlineToBr() public static method

Add
tags in front of all newlines in input string
public static NewlineToBr ( string input ) : string
input string
return string

Plus() public static method

Addition
public static Plus ( object input, object operand ) : object
input object
operand object
return object

Prepend() public static method

Prepend a string to another
public static Prepend ( string input, string @string ) : string
input string
@string string
return string

Remove() public static method

Remove a substring
public static Remove ( string input, string @string ) : string
input string
@string string
return string

RemoveFirst() public static method

Remove the first occurrence of a substring
public static RemoveFirst ( string input, string @string ) : string
input string
@string string
return string

Replace() public static method

Replace occurrences of a string with another
public static Replace ( string input, string @string ) : string
input string
@string string
return string

Replace() public static method

Replace occurrences of a string with another
public static Replace ( string input, string @string, string replacement ) : string
input string
@string string
replacement string
return string

ReplaceFirst() public static method

Replace the first occurence of a string with another
public static ReplaceFirst ( string input, string @string ) : string
input string
@string string
return string

ReplaceFirst() public static method

Replace the first occurence of a string with another
public static ReplaceFirst ( string input, string @string, string replacement ) : string
input string
@string string
replacement string
return string

Round() public static method

public static Round ( object input, object places = null ) : object
input object
places object
return object

Size() public static method

Return the size of an array or of an string
public static Size ( object input ) : int
input object
return int

Slice() public static method

Return a Part of a String
public static Slice ( string input, int start, int len = 1 ) : string
input string
start int
len int
return string

Sort() public static method

Sort elements of the array provide optional property with which to sort an array of hashes or drops
public static Sort ( object input ) : IEnumerable
input object
return IEnumerable

Sort() public static method

Sort elements of the array provide optional property with which to sort an array of hashes or drops
public static Sort ( object input, string property ) : IEnumerable
input object
property string
return IEnumerable

Split() public static method

Split input string into an array of substrings separated by given pattern.
public static Split ( string input, string pattern ) : string[]
input string
pattern string
return string[]

StripHtml() public static method

public static StripHtml ( string input ) : string
input string
return string

StripNewlines() public static method

Remove all newlines from the string
public static StripNewlines ( string input ) : string
input string
return string

Times() public static method

Multiplication
public static Times ( object input, object operand ) : object
input object
operand object
return object

Truncate() public static method

Truncates a string down to 15 characters
public static Truncate ( string input ) : string
input string
return string

Truncate() public static method

Truncates a string down to length characters
public static Truncate ( string input, int length ) : string
input string
length int
return string

Truncate() public static method

Truncates a string down to x characters
public static Truncate ( string input, int length, string truncateString ) : string
input string
length int
truncateString string
return string

TruncateWords() public static method

public static TruncateWords ( string input ) : string
input string
return string

TruncateWords() public static method

public static TruncateWords ( string input, int words ) : string
input string
words int
return string

TruncateWords() public static method

public static TruncateWords ( string input, int words, string truncateString ) : string
input string
words int
truncateString string
return string

Upcase() public static method

convert a input string to UPCASE
public static Upcase ( string input ) : string
input string
return string

UrlEncode() public static method

convert a input string to URLENCODE
public static UrlEncode ( string input ) : string
input string
return string