MFGS Misc
MFGSMisc Public interface
Description
Describes methods and properties available on the static instance object MFGS.Misc
Diagram
flowchart LR classDef interfaceStyle stroke-dasharray: 5 5; classDef abstractStyle stroke-width:4px subgraph VGWWCoreIEx VGWWCoreIEx.IExMFGSMisc[[IExMFGSMisc]] class VGWWCoreIEx.IExMFGSMisc interfaceStyle; endMembers
Methods
Public methods
| Returns | Name |
|---|---|
string``[] | ASCIIArray(string text, string delimiter, int offset)Parses a string into an array of strings. |
string | ASCIIField(string text, int position, string delimiter)Get subset of the text based on the position and delimiter. |
object | Create(MFGSCreateType type, object``[] args)Creates an object based on the parameters passed in. |
string | LPad(string text, int length, string padChar)Returns a new string of a specified length in which the beginning of the text string is padded with spaces or the specified padChar character. |
string | RPad(string text, int length, string padChar)Returns a new string of a specified length in which the end of the text string is padded with spaces or the specified padChar character. |
object | Switch(object value, object``[] args)Compares the value to the odd-numbered parameters and when equal will return the subsequent even-numbered parameter value. |
IMFGSList | TextWrap(string text, int width, int lines)Breaks a string into separate lines. |
Details
Summary
Describes methods and properties available on the static instance object MFGS.Misc
Methods
ASCIIArray
public string ASCIIArray(string text, string delimiter, int offset)Arguments
| Type | Name | Description |
|---|---|---|
string | text | The string to parse. |
string | delimiter | The delimiter between each string to be added to the array. |
int | offset | The starting index of values parsed into the array. |
Summary
Parses a string into an array of strings.
Remarks
As the text is parsed the delimiter is removed and will not be include in the string array values.
Double-quotes are used to signify a section of text where the delimiter string should be ignored.
The array returned is 0-based and the length will be equal to the number of parsed values found + offset .
If offset is greater than zero the value of elements 0 thru offset will be an empty string.
Returns
An array of strings
ASCIIField
public string ASCIIField(string text, int position, string delimiter)Arguments
| Type | Name | Description |
|---|---|---|
string | text | The string to search. |
int | position | The 1-based position of the text subset. |
string | delimiter | The delimiter used to parse the text into subsets. |
Summary
Get subset of the text based on the position and delimiter.
Returns
A string value, or an empty string if text is null or empty, or an empty string if position is zero or less.
Create
public object Create(MFGSCreateType type, object[] args)Arguments
| Type | Name | Description |
|---|---|---|
MFGSCreateType | type | The type of object to create. |
object``[] | args | Optional parameters used when creating the object |
Summary
Creates an object based on the parameters passed in.
Returns
Switch
public object Switch(object value, object[] args)Arguments
| Type | Name | Description |
|---|---|---|
object | value | The value to be compared. |
object``[] | args | The parameters passed to the method where the relative position of each determines its use. |
Summary
Compares the value to the odd-numbered parameters and when equal will return the subsequent even-numbered parameter value.
Remarks
Parameters should be passed in as sets of two, with the first one being the one to compare against value, and the second one being the value returned. The last parameter passed in is the default value to be returned if no match is found. If no default value parameter is passed in, the method will return null (or empty string in VBA) is no match is found. If no parameters are passed in, the method will return null (or empty string in VBA). This method uses the VBA equals (=) operator for comparison which is affected by the ‘Option Compare’ declaration.
Returns
A value based on the parameters passed in.
TextWrap
public IMFGSList TextWrap(string text, int width, int lines)Arguments
| Type | Name | Description |
|---|---|---|
string | text | The string to line-break. |
int | width | The max number of characters per line. |
int | lines | The max number of lines. |
Summary
Breaks a string into separate lines.
Remarks
This method will first line-break text on any carriage return (“\r”) or line feed (“\n”) characters found.
Each line is then further broken apart on the last space (” ”) character found without exceeding the width .
If a space character cannot be found the line is broken at width .
Any leading or trailing whitespace characters of each line will be removed.
If text contains only whitespace, or width is zero, or lines is zero, then an empty IMFGSList object will be returned.
If width is less than zero, the returned IMFGSList object will contain a single line containing text .
If lines is less than zero, then there is no limit on the max number of lines.
If lines is greater than zero, and the number of lines created by breaking the text does not exceed this value,
an empty string will be inserted into the the returned IMFGSList object until Count equals this value.
Returns
An IMFGSList object containing zero or more string values depending on the parameters passed.
LPad
public string LPad(string text, int length, string padChar)Arguments
| Type | Name | Description |
|---|---|---|
string | text | The string to be padded. |
int | length | The minimum length of the returned string. |
string | padChar | The character used to pad the string. |
Summary
Returns a new string of a specified length in which the beginning of the text string is padded with spaces or the specified padChar character.
Returns
A new string that is equivalent to text , but right-aligned and padded on the left with as many characters as needed to reach length .
However, if length is less than or equal to the length of text , the method returns text .
If padChar is ommited or an empty string, a space will be used as the padding chracter.
If padChar contains more than one character, only the first character will be used to pad the string.
RPad
public string RPad(string text, int length, string padChar)Arguments
| Type | Name | Description |
|---|---|---|
string | text | The string to be padded. |
int | length | The minimum length of the returned string. |
string | padChar | The character used to pad the string. |
Summary
Returns a new string of a specified length in which the end of the text string is padded with spaces or the specified padChar character.
Returns
A new string that is equivalent to text , but left-aligned and padded on the right with as many characters as needed to reach length .
However, if length is less than or equal to the length of text , the method returns text .
If padChar is ommited or an empty string, a space will be used as the padding chracter.
If padChar contains more than one character, only the first character will be used to pad the string.
Generated with ModularDoc