Show / Hide Table of Contents

Class TextBlocks

This class defines methods for creating and manipulating bounded text blocks.

Inheritance
System.Object
TextBlocks
Namespace: WizardWrx
Assembly: WizardWrx.Core.dll
Syntax
public class TextBlocks : object

Constructors

| Improve this Doc View Source

TextBlocks()

The default constructor creates an empty class. Its MarkerText property must be set before its other properties are useful.

Declaration
public TextBlocks()
| Improve this Doc View Source

TextBlocks(String)

This overload creates an empty class, and initializes its MarkerText property.

Declaration
public TextBlocks(string pstrMarkerText)
Parameters
Type Name Description
System.String pstrMarkerText

String containing text from which marker prefixes and suffixes are constructed. Also sets the MarkerText property.

| Improve this Doc View Source

TextBlocks(String, String)

This overload creates an empty class, and initializes its rInputData and MarkerText properties.

Declaration
public TextBlocks(string pstrInputData, string pstrMarkerText)
Parameters
Type Name Description
System.String pstrInputData

String containing text from which marked blocks will be extracted. Also sets the InputData property.

System.String pstrMarkerText

String containing text from which marker prefixes and suffixes are constructed. Also sets the MarkerText property.

Fields

| Improve this Doc View Source

BLOCK_BEGIN_TEXT

My text block begin markers always end with this string.

Declaration
public const string BLOCK_BEGIN_TEXT = null
Field Value
Type Description
System.String
| Improve this Doc View Source

BLOCK_END_TEXT

My text block ending markers always end with this string.

Declaration
public const string BLOCK_END_TEXT = null
Field Value
Type Description
System.String

Properties

| Improve this Doc View Source

InputData

String from which to extract blocks.

Declaration
public string InputData { get; set; }
Property Value
Type Description
System.String
| Improve this Doc View Source

MarkerText

This is the text that forms the middle (and variable) part of the TextBlocks marker strings.

Declaration
public string MarkerText { get; set; }
Property Value
Type Description
System.String
| Improve this Doc View Source

Prefix

Construct, on the fly, and return, the block prefix.

Declaration
public string Prefix { get; }
Property Value
Type Description
System.String
| Improve this Doc View Source

Suffix

Construct, on the fly, and return, the block suffix.

Declaration
public string Suffix { get; }
Property Value
Type Description
System.String

Methods

| Improve this Doc View Source

CharToArray(Char)

Return a one-element array containing the input character.

Declaration
public static char[] CharToArray(char pchr)
Parameters
Type Name Description
System.Char pchr

Character to place into the returned array.

Returns
Type Description
System.Char[]

Array of characters, containing exactly one element, which contains the single input character.

| Improve this Doc View Source

ExtractBlock()

Extract a block marked by text constructed from the string in the MarkerText property from the text in the InputData property.

Declaration
public string ExtractBlock()
Returns
Type Description
System.String

Text between block markers. If the prefix marker is followed by a newline, the newline is removed. Likewise, if the suffix marker is preceded by a newline, that newline is also removed.

| Improve this Doc View Source

ExtractBlock(String)

Extract a block marked by text constructed from the string in argument pstrMarkerText from the text in the InputData property, and update the MarkerText property.

Declaration
public string ExtractBlock(string pstrMarkerText)
Parameters
Type Name Description
System.String pstrMarkerText

String containing text from which marker prefixes and suffixes are constructed. Also sets the MarkerText property.

Returns
Type Description
System.String

Text between block markers. If the prefix marker is followed by a newline, the newline is removed. Likewise, if the suffix marker is preceded by a newline, that newline is also removed.

| Improve this Doc View Source

ExtractBlock(String, String)

Extract a block marked by text constructed from the string in argument pstrMarkerText from the text in argument pstrInputData. Update the InputData and MarkerText properties.

Declaration
public string ExtractBlock(string pstrInputData, string pstrMarkerText)
Parameters
Type Name Description
System.String pstrInputData

String containing text from which marked blocks will be extracted. Also sets the InputData property.

System.String pstrMarkerText

String containing text from which marker prefixes and suffixes are constructed. Also sets the MarkerText property.

Returns
Type Description
System.String

Text between block markers. If the prefix marker is followed by a newline, the newline is removed. Likewise, if the suffix marker is preceded by a newline, that newline is also removed.

| Improve this Doc View Source

ExtractBlockToArray()

Extract a block marked by text constructed from the string in argument pstrMarkerText from the text in argument pstrInputData. Update the InputData and MarkerText properties.

Declaration
public string[] ExtractBlockToArray()
Returns
Type Description
System.String[]

Array of strings containing the text between block markers. If the prefix marker is followed by a newline, the newline is removed. Likewise, if the suffix marker is preceded by a newline, that newline is also removed.

| Improve this Doc View Source

ExtractBlockToArray(String)

Extract a block marked by text constructed from the string in argument pstrMarkerText from the text in argument pstrInputData. Update the InputData and MarkerText properties.

Declaration
public string[] ExtractBlockToArray(string pstrMarkerText)
Parameters
Type Name Description
System.String pstrMarkerText

String containing text from which marker prefixes and suffixes are constructed. Also sets the MarkerText property.

Returns
Type Description
System.String[]

Array of strings containing the text between block markers. If the prefix marker is followed by a newline, the newline is removed. Likewise, if the suffix marker is preceded by a newline, that newline is also removed.

| Improve this Doc View Source

ExtractBlockToArray(String, String)

Extract a block marked by text constructed from the string in argument pstrMarkerText from the text in argument pstrInputData. Update the InputData and MarkerText properties.

Declaration
public string[] ExtractBlockToArray(string pstrInputData, string pstrMarkerText)
Parameters
Type Name Description
System.String pstrInputData

String containing text from which marked blocks will be extracted. Also sets the InputData property.

System.String pstrMarkerText

String containing text from which marker prefixes and suffixes are constructed. Also sets the MarkerText property.

Returns
Type Description
System.String[]

Array of strings containing the text between block markers. If the prefix marker is followed by a newline, the newline is removed. Likewise, if the suffix marker is preceded by a newline, that newline is also removed.

| Improve this Doc View Source

StringOfLinesToArray(String)

Split a string containing lines of text into an array of strings.

Declaration
public static string[] StringOfLinesToArray(string pstrLines)
Parameters
Type Name Description
System.String pstrLines

String containing lines of text, terminated by CR/LF pairs.

Returns
Type Description
System.String[]

Array of strings, one line per string. Blank lines are preserved as empty strings.

| Improve this Doc View Source

StringOfLinesToArray(String, StringSplitOptions)

Split a string containing lines of text into an array of strings, as modified by the StringSplitOptions flag.

Declaration
public static string[] StringOfLinesToArray(string pstrLines, StringSplitOptions penmStringSplitOptions)
Parameters
Type Name Description
System.String pstrLines

String containing lines of text, terminated by CR/LF pairs.

StringSplitOptions penmStringSplitOptions

A member of the StringSplitOptions enumeration, presumably other than StringSplitOptions.None, which is assumed by the first overload. The only option supported by version 2 of the Microsoft .NET CLR is RemoveEmptyEntries.

Returns
Type Description
System.String[]

Array of strings, one line per string. Blank lines are preserved as empty strings unless penmStringSplitOptions is RemoveEmptyEntries, as is most likely to be the case.

Remarks

Use this overload to convert a string, discarding blank lines.

| Improve this Doc View Source

StringToArray(String)

Return a one-element array containing the input string.

Declaration
public static string[] StringToArray(string pstr)
Parameters
Type Name Description
System.String pstr

String to place into the returned array.

Returns
Type Description
System.String[]

Array of strings, containing exactly one element, which contains the single input string.

  • Improve this Doc
  • View Source
Back to top Generated by DocFX