Programming Reference for VirtualLab Fusion  2022.1
Static Public Member Functions | List of all members
VL_Strings Class Reference

This class provides methods for converting VirtualLab objects to a string. More...

Static Public Member Functions

static string ToString (Complex complexValue, PhysicalProperty physicalProperty=PhysicalProperty.NoUnit, int numberOfDigits=int.MaxValue, ComplexToStringConversionFormat conversionFormat=ComplexToStringConversionFormat.AmplitudePhase)
 Converts a complex value to a string. More...
 
static string ToString (double doubleValue, PhysicalProperty physicalProperty=PhysicalProperty.NoUnit, int numberOfDigits=int.MaxValue)
 Converts a floating point number in double precision to a string. More...
 
static string ToString (int integer, bool useGroupSeparator=false)
 Converts an integer value to a string. More...
 
static string ToString (PhysicalValue physicalValue, int numberOfDigits=int.MaxValue, bool showPhysicalUnits=true, bool prependComment=false)
 Converts a physical value to a string. More...
 
static string ToString (PhysicalValueComplex physicalValue, int numberOfDigits=int.MaxValue, bool showPhysicalUnits=true, bool prependComment=false, ComplexToStringConversionFormat conversionFormat=ComplexToStringConversionFormat.AmplitudePhase)
 Converts a complex physical value to a string. More...
 

Detailed Description

This class provides methods for converting VirtualLab objects to a string.

Member Function Documentation

◆ ToString() [1/5]

static string ToString ( Complex  complexValue,
PhysicalProperty  physicalProperty = PhysicalProperty.NoUnit,
int  numberOfDigits = int.MaxValue,
ComplexToStringConversionFormat  conversionFormat = ComplexToStringConversionFormat.AmplitudePhase 
)
static

Converts a complex value to a string.

Parameters
complexValueThe Complex value to convert.
physicalPropertyThis optional parameter allows you to set the PhysicalProperty used for the output. For example a complex amplitude is formatted as “1 \(\mu\)V/m \(\cdot\) exp(i \(f = 10^{-a}\))” instead of “1e-6 \(\cdot\) exp(i \(f = 10^{-a}\))” if this parameter is set to PhysicalProperty.ElectricalField.
numberOfDigitsOptional parameter to set the number of digits shown in the string. If this parameter is not specified, the precision set in the Global Options dialog is used.
conversionFormatOptional parameter to specify the format of the complex number. If you set this parameter to ComplexToStringConversionFormat.RealImaginary, the value is formatted as “{Real} + {Imaginary} \(\cdot\)i”. If you set it to ComplexToStringConversionFormat.AmplitudePhase (the default), the value is formatted as “{Amplitude} \(\cdot\) exp(i \(\cdot\){Phase})”.
Returns
The complex value as string.

◆ ToString() [2/5]

static string ToString ( double  doubleValue,
PhysicalProperty  physicalProperty = PhysicalProperty.NoUnit,
int  numberOfDigits = int.MaxValue 
)
static

Converts a floating point number in double precision to a string.

Parameters
doubleValueThe double value to convert.
physicalPropertyThis optional parameter allows you to set the PhysicalProperty used for the output. For example a wavelength is formatted as “532 nm” instead of “5.32e-7” if this parameter is set to PhysicalProperty.Length.
numberOfDigitsOptional parameter to set the number of digits shown in the string. If this parameter is not specified, the precision set in the Global Options dialog is used.
Returns
The double value as string.

◆ ToString() [3/5]

static string ToString ( int  integer,
bool  useGroupSeparator = false 
)
static

Converts an integer value to a string.

Parameters
integerThe integer value to convert.
useGroupSeparatorIf this optional parameter is set to true, the integer 1234567 is converted to “1'234'567”.
Returns
The integer value as string.

◆ ToString() [4/5]

static string ToString ( PhysicalValue  physicalValue,
int  numberOfDigits = int.MaxValue,
bool  showPhysicalUnits = true,
bool  prependComment = false 
)
static

Converts a physical value to a string.

Parameters
physicalValueThe PhysicalValue object to convert.
numberOfDigitsOptional parameter to set the number of digits shown in the string. If this parameter is not specified, the precision set in the Global Options dialog is used.
showPhysicalUnitsIf this optional parameter is set to false, no units are shown which can be useful if you want to to use the string in other programs not supporting physical units. For example a wavelength is then formatted as “5.32e-7” instead of “532 nm”.
prependCommentIf this optional parameter is set to true, the comment of the physical value is prepended. This means that the string is formatted as “{Comment} of {Value [with units]}” (e. g. “wavelength of 300 nm”).
Returns
The physical value as string.

◆ ToString() [5/5]

static string ToString ( PhysicalValueComplex  physicalValue,
int  numberOfDigits = int.MaxValue,
bool  showPhysicalUnits = true,
bool  prependComment = false,
ComplexToStringConversionFormat  conversionFormat = ComplexToStringConversionFormat.AmplitudePhase 
)
static

Converts a complex physical value to a string.

Parameters
physicalValueThe PhysicalValue object to convert.
numberOfDigitsOptional parameter to set the number of digits shown in the string. If this parameter is not specified, the precision set in the Global Options dialog is used.
showPhysicalUnitsIf this optional parameter is set to false, no units are shown which can be useful if you want to to use the string in other programs not supporting physical units.
prependCommentIf this optional parameter is set to true, the comment of the physical value is prepended. This means that the string is formatted as “{Comment} of {Value [with units]}” (e. g. “complex amplitude of 1 \(\cdot\)exp(2) V/m”).
conversionFormatOptional parameter to specify the format of the complex number. If you set this parameter to ComplexToStringConversionFormat.RealImaginary, the value is formatted as “{Real} + {Imaginary} \(\cdot\)i”. If you set it to ComplexToStringConversionFormat.AmplitudePhase (the default), the value is formatted as “{Amplitude} \(\cdot\) exp(i \(\cdot\){Phase})”.
Returns
The complex physical value as string.