|
Programming Reference for VirtualLab Fusion
2026.1
|
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 Public Member Functions | |
| static string | AddPluralS (int numberOfEntries, string singularString) |
| Adds the plural-s to the given string if there are two or more entries and English language is used. | |
| static string | AddPluralS (string singularString) |
| Adds the plural-s to the given string if English language is used. | |
| 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. | |
| static string | CommonStartStringOfArrayEntries (string[] arrayOfStrings, bool onlyCompleteWords) |
| Method which extracts a common string all entries of a string array start with. | |
| static string | ConcatenateStrings (string[] strings) |
| Concatenates the given strings each with a space in between (but in Chinese culture). | |
| static string[] | ExtractFromFormattedString (string completeString, string formatString, bool removeSpacesInFormatString) |
| If a string was formatted e.g. with the format string "{0} … {1}", this method extracts the original strings which were placed in the place holders {0} and {1}. This method only works if the strings between the original strings are not contained in the original strings. E.g. if you put "0 … 1" and "2" in the aforementioned format string, you obtain "0 … 1 … 2" which cannot be converted back properly. | |
| 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. | |
| static string | ListToString (string prefix, 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. | |
| static string | MakeSansSerifBold (string stringToConvert) |
| Writes the given string in sans-serif bold letters. To this end the Unicode block "Mathematical Alphanumeric Symbols" (https://en.wikipedia.org/wiki/Mathematical_Alphanumeric_Symbols) is used. Thus the result might not look completely as desired and this method should only used for to emphasize short portions of text. | |
| static string | MoreLegibleVariableName (string variableName) |
| Converts the given variable name into a more legible name by applying the following rules. | |
| static string | PrependTimeStamp (this string stringToConvert) |
| This extension method prepends a time stamp to the given string (and appends a line break). | |
| static string | ReplaceAnyCharacter (this string inputString, string stringToInsert, char[] charactersToReplace) |
| Replaces several distinct character of a string by the same character. | |
| static string | ReplaceAnyString (this string inputString, string stringToInsert, string[] stringsToReplace) |
| Replaces several distinct substring of a string by the same string. | |
| static string | SplitName (string name) |
| This method converts variable names into more readable strings by applying the following rules: | |
| static IEnumerable< string > | SplitToLines (this string input) |
| Splits this string into an array with one entry per line. | |
| static bool | StringContainsAnyPartialString (string stringToCheck, List< string > partialStrings) |
| This method determines whether the given string contains any of the given partial strings. If the search should be case insensitive, both parameters should be passed as uppercase (or lowercase). | |
| static string | ToLongDateString_VL (this DateTime date) |
| Converts the value of the current DateTime object to its equivalent long date string representation. In contrast to the .Net implementation, this considers the current UI language and contains a fix for Chinese dates. | |
| static string | ToOrdinal (this int number) |
| Get the ordinal value of positive integers. | |
| static string | ToString_VL (this double number, int? numberOfSignificantDigits=null) |
| Converts the numeric value of this instance to its equivalent string representation, using the specified number of digits (by default DefaultNumberOfSignificantDigits). | |
| static string | ToString_VL (this double number, out bool trailingZerosConvertedToDecimalPower, int? numberOfSignificantDigits=null, int? magnitudeThresholdForExponent=null) |
| Converts the numeric value of this instance to its equivalent string representation, using the specified number of digits (by default DefaultNumberOfSignificantDigits). | |
| static string | ToUpperFirstLetter (this string stringToConvert) |
| This extension method converts a given string so that the first letter of the first word is upper case, all other characters are lower case. | |
| static string | ToUpperFirstLetters (this string stringToConvert) |
| This extension method converts a given string so that the first letter of each word is upper case, all other characters are lower case. | |
Static Public Attributes | |
| const string | Back_String |
| String to be used for 'Back' buttons in wizards and similar controls. | |
| const string | DateTimeFormatISOBasic |
| A basic date time format which complies with ISO 8601. It avoids ":" (as separator of time units) and "/" (date unit separator in several cultures) and thus should be used for file names. | |
| const string | DateTimeFormatISOExtended |
| An extended date time format which complies with ISO 8601. The datum is separated by hyphens and time is separated by colons. | |
| 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. | |
| static int | DefaultNumberOfSignificantDigits |
| The default number of significant digits with which double numbers are formatted. Usually the value from the Global Options. | |
| const string | Finish_String |
| String to be used for 'Finish' buttons in wizards and similar controls. | |
| const int | MaximumNumberOfSignificantDigits |
| The absolute maximum number of significant digits for double values. Should only be used for export of numbers to other programs. Note that https://learn.microsoft.com/en-us/dotnet/fundamentals/runtime-libraries/system-double states that for doubles there are only 15 digits of precision for anyhow. | |
| const string | NeverUsedCharacter |
| A character which is most likely never used in real-life strings (Tibetian symbol for "8.5"). | |
| const string | Next_String |
| String to be used for 'Next' buttons in wizards and similar controls. | |
| static readonly string | NotApplicableString |
| String to be used if a correct meaning is not yet known. (= "N/A") | |
| const int | RecommendedMaximumNumberOfSignificantDigits |
| Maximal Number of decimal digits recommended for the formatting as string of a physical value or another value with a unit. More digits can usually not measured anyhow. If the user enters a higher value in the Global Options dialog, display of numbers may be truncated in some dialogs. | |
| const int | RecommendedNumberOfSignificantDigits |
| The recommended number of digits, for example the predefined value for the DefaultNumberOfSignificantDigits defined by the user. | |
| 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. | |
| const string | SpaceReplacement |
| "Bottom half o" = ᴗ. Used as replacement for space in variable names. | |
| static bool | UseIndicatorForHiddenDigits |
| If for a physical value some digits where hidden due to rounding, shall a symbol (e.g. "…") indicate this? | |
Properties | |
| 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.
|
static |
Adds the plural-s to the given string if there are two or more entries and English language is used.
| numberOfEntries | The number of entries. |
| singularString | The string to which the plural-s shall be added. |
|
static |
Adds the plural-s to the given string if English language is used.
| singularString | The string to which the plural-s shall be added. |
|
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.
| 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. |
|
static |
Method which extracts a common string all entries of a string array start with.
| arrayOfStrings | Array of strings to be examined. |
| onlyCompleteWords | true: Only complete words are extracted. |
|
static |
Concatenates the given strings each with a space in between (but in Chinese culture).
| strings | The strings to concatenate. |
|
static |
If a string was formatted e.g. with the format string "{0} … {1}", this method extracts the original strings which were placed in the place holders {0} and {1}. This method only works if the strings between the original strings are not contained in the original strings. E.g. if you put "0 … 1" and "2" in the aforementioned format string, you obtain "0 … 1 … 2" which cannot be converted back properly.
| completeString | The complete string which was formatted using the format string. |
| formatString | The format string. |
| removeSpacesInFormatString | Spaces before the curly brackets in the format string are removed. In this way, for something like "0…1" parsing to integers works if the format string is "{0} … {1}". |
|
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.
| 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. |
|
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.
| prefix | Single word prepended to the list entries. Maybe a plural-s is added to it. |
| 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. |
|
static |
Writes the given string in sans-serif bold letters. To this end the Unicode block "Mathematical Alphanumeric Symbols" (https://en.wikipedia.org/wiki/Mathematical_Alphanumeric_Symbols) is used. Thus the result might not look completely as desired and this method should only used for to emphasize short portions of text.
| stringToConvert | The string to convert. Only the standard Latin letters 'A' to 'Z' and 'a' to 'z' as well as digits are supported, other characters remain unchanged. |
|
static |
Converts the given variable name into a more legible name by applying the following rules.
Examples: "FMMᴗSampling" → "FMM Sampling"; "x__Range" → "x-Range".
| variableName | The variable name. |
|
static |
This extension method prepends a time stamp to the given string (and appends a line break).
| stringToConvert | The string to convert. You can use this method also as stringToConvert.PrependTimeStamp(). |
|
static |
Replaces several distinct character of a string by the same character.
| inputString | The string where characters shall be replaced. |
| stringToInsert | The string to insert instead of any of the charactersToReplace. |
| charactersToReplace | Array of characters each of which is replaced by stringToInsert. |
|
static |
Replaces several distinct substring of a string by the same string.
| inputString | The string where substrings shall be replaced. |
| stringToInsert | The string to insert instead of any of the stringsToReplace. |
| stringsToReplace | Array of strings each of which is replaced by stringToInsert. |
|
static |
This method converts variable names into more readable strings by applying the following rules:
Examples: "JustAnOtherTest" → "Just An Other Test"; "FMMᴗSampling" → "FMM Sampling"; "x_Range" → "x-Range".
| name | The variable name to convert. |
|
static |
Splits this string into an array with one entry per line.
| input | The input string. |
|
static |
This method determines whether the given string contains any of the given partial strings. If the search should be case insensitive, both parameters should be passed as uppercase (or lowercase).
| stringToCheck | The string to search. |
| partialStrings | List of partial strings. |
True if any of the given partial strings is part of the stringToCheck.
|
static |
Converts the value of the current DateTime object to its equivalent long date string representation. In contrast to the .Net implementation, this considers the current UI language and contains a fix for Chinese dates.
| date | The date to convert. |
|
static |
Get the ordinal value of positive integers.
| number | The number. |
|
static |
Converts the numeric value of this instance to its equivalent string representation, using the specified number of digits (by default DefaultNumberOfSignificantDigits).
| number | The number to format. |
| numberOfSignificantDigits | The number of significant digits. Must be between 1 and 17 (inclusive). If this optional parameter is omitted, the value of DefaultNumberOfSignificantDigits is used, which is usually the value from the Global Options. |
| System.ArgumentException | Wrong number of digits used for formatting of a double value. |
|
static |
Converts the numeric value of this instance to its equivalent string representation, using the specified number of digits (by default DefaultNumberOfSignificantDigits).
| number | The number to format. |
| numberOfSignificantDigits | The number of significant digits. Must be between 1 and 17 (inclusive). If this optional parameter is omitted, the value of DefaultNumberOfSignificantDigits is used, which is usually the value from the Global Options. |
| trailingZerosConvertedToDecimalPower | Flag indicating whether or not trailing zeros has been converted to decimal power. |
| magnitudeThresholdForExponent | From which magnitude a number shall be written with exponent? Example: 10'000 will be written as '1e+4' if this parameter is less than or equal to 4. |
| System.ArgumentException | Wrong number of digits used for formatting of a double value. |
|
static |
This extension method converts a given string so that the first letter of the first word is upper case, all other characters are lower case.
| stringToConvert | The string to convert. You can use this method also as stringToConvert.ToUpperFirstLetter(). |
|
static |
This extension method converts a given string so that the first letter of each word is upper case, all other characters are lower case.
| stringToConvert | The string to convert. You can use this method also as stringToConvert.ToUpperFirstLetters(). |