C# Класс Iaik.Utils.SimpleFormatter

Simple Textformatter {[Name]:ALIGNMENT:WIDTH:FILLCHAR} or {index:ALIGNMENT:WIDTH:FILLCHAR} or {"text":...} [Name] is the name of a defined text macro index is the index in the passed parameter list "text" is a freestyle text to be formatted ALIGNMENT =LN ... left-aligned and do not fill =LF ... left aligned and fill up = M ... centered = R ... right-aligned WIDTH Tells the formatter to which width the text should be aligned FILLCHAR For LF and R. Char used to fill
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
DefineTextMacro ( string name, string value ) : void

Defines a text macro

Format ( string format ) : string

Formats a string, see class description for formatting instructions

StaticFormat ( string format ) : string
UndefineTextMacro ( string name ) : void

Removes a text macro

Приватные методы

Метод Описание
EscapeSafeSplit ( string toEscape, char splitBy ) : string[]
FindNextNotEscaped ( int offset, string findIn, string toFind ) : int

Finds the next not escaped character (tofind)

FindStartMarker ( int offset, string str ) : int?

Finds the next formatable part "{..."

FormatLF ( int length, string val, char fillChar ) : string
FormatLN ( int length, string val ) : string
FormatM ( int length, string val, char fillChar ) : string
FormatPacket ( string format, object args ) : string

Does the formating stuff

FormatR ( int length, string val, char fillChar ) : string
GetFormatPacket ( int &offset, string str ) : string

Gets the formatable packet. It assumes that offset is already located after the start marker "{"

StringifyParameter ( object arg ) : string
Unescape ( string escaped ) : string

Описание методов

DefineTextMacro() публичный Метод

Defines a text macro
public DefineTextMacro ( string name, string value ) : void
name string
value string
Результат void

Format() публичный Метод

Formats a string, see class description for formatting instructions
public Format ( string format ) : string
format string
Результат string

StaticFormat() публичный статический Метод

public static StaticFormat ( string format ) : string
format string
Результат string

UndefineTextMacro() публичный Метод

Removes a text macro
public UndefineTextMacro ( string name ) : void
name string
Результат void