This class is subject to change. Programs using this class may require changes with a new version of VirtualLab.
Class containing static methods to create strings formatted in a special way.
More...
|
| static string | ArrayToString (object[] array, string conjunction="and", bool useQuotationMarks=false, bool createList=false) |
| | Converts the given array to a string containing all individual members. E.g. something like "a", "a and b", and "a, b, and c" (for one two or three entries in the array respectively. More...
|
| |
| static string | ListToString (IList list, string conjunction="and", bool useQuotationMarks=false, bool createList=false) |
| | Converts the given list to a string containing all individual members. E.g. something like "a", "a and b", and "a, b, and c" (for one two or three entries in the list respectively. More...
|
| |
| static string | MoreLegibleVariableName (string variableName) |
| | Converts the given variable name into a more legible name by applying the following rules. More...
|
| |
| static string | SplitName (string name) |
| | This method converts variable names into more readable strings by applying the following rules: More...
|
| |
| static string | ToOrdinal (this int number) |
| | Get the ordinal value of positive integers. More...
|
| |
|
|
static readonly CultureInfo | DefaultCulture |
| | The default culture used for string formatting. It is the "en-US" culture with a dot as decimal separator and a thin space as number group separator.
|
| |
|
const string | NotApplicableString |
| | String to be used if a correct meaning is not yet known. (= "N/A")
|
| |
|
const string | SortCharacter |
| | If you add this character at the beginning of a string, it is sorted before any "normal" strings. This character is a zero-width space.
|
| |
|
|
static NumberFormatInfo | NumberFormat [get] |
| | Default numerical format
|
| |
This class is subject to change. Programs using this class may require changes with a new version of VirtualLab.
Class containing static methods to create strings formatted in a special way.
◆ ArrayToString()
| static string ArrayToString |
( |
object[] |
array, |
|
|
string |
conjunction = "and", |
|
|
bool |
useQuotationMarks = false, |
|
|
bool |
createList = false |
|
) |
| |
|
static |
Converts the given array to a string containing all individual members. E.g. something like "a", "a and b", and "a, b, and c" (for one two or three entries in the array respectively.
- Parameters
-
| array | The array to convert. If you want apply special formatting first convert the array of objects to an array of strings (formatted as you want it). |
| conjunction | The conjunction used if two or more entries are present. "and" by default. Can also be empty if you do not want to use a conjunction. |
| useQuotationMarks | If this optional parameter is set to true, each entry is embedded in quotation marks. E. g.: “a”, “b”, or “c”. |
| createList | If this optional parameter is set to true, the entries are written as a bullet list. |
- Returns
- The formatted string.
◆ ListToString()
| static string ListToString |
( |
IList |
list, |
|
|
string |
conjunction = "and", |
|
|
bool |
useQuotationMarks = false, |
|
|
bool |
createList = false |
|
) |
| |
|
static |
Converts the given list to a string containing all individual members. E.g. something like "a", "a and b", and "a, b, and c" (for one two or three entries in the list respectively.
- Parameters
-
| list | The list to convert. If you want apply special formatting first convert the list of objects to an array or list of strings (formatted as you want it). |
| conjunction | The conjunction used if two or more entries are present. "and" by default. |
| useQuotationMarks | If this optional parameter is set to true, each entry is embedded in quotation marks. E. g.: “a”, “b”, or “c”. |
| createList | If this optional parameter is set to true, the entries are written as a bullet list. |
- Returns
- The formatted string.
◆ MoreLegibleVariableName()
| static string MoreLegibleVariableName |
( |
string |
variableName | ) |
|
|
static |
Converts the given variable name into a more legible name by applying the following rules.
-
"__" (double underscore) is replaced by "-"
-
"ᴗ" is replaced by a space.
Examples: "FMMᴗSampling" → "FMM Sampling"; "x__Range" → "x-Range".
- Parameters
-
| variableName | The variable name. |
- Returns
- The more legible name, which ca no longer be used as variable name.
◆ SplitName()
| static string SplitName |
( |
string |
name | ) |
|
|
static |
This method converts variable names into more readable strings by applying the following rules:
-
"_" is replaced by "-"
-
If there are "ᴗ" in the string these symbols are replaced by spaces and the resulting string is returned.
-
Else a space is inserted before any uppercase character prepended by a character which is not "-" or "_".
Examples: "JustAnOtherTest" → "Just An Other Test"; "FMMᴗSampling" → "FMM Sampling"; "x_Range" → "x-Range".
- Parameters
-
| name | The variable name to convert. |
- Returns
- The converted variable name split into single words.
◆ ToOrdinal()
| static string ToOrdinal |
( |
this int |
number | ) |
|
|
static |
Get the ordinal value of positive integers.
- Parameters
-
- Returns
- Ordinal value of positive integers, or int.ToString() if less than 1.