Class VL_Strings
- Namespace
- VirtualLab.Programming
- Assembly
- VirtualLab.Programming.dll
This class provides methods for converting VirtualLab objects to a string.
public static class VL_Strings
- Inheritance
-
VL_Strings
- Inherited Members
Methods
ToString(double, PhysicalProperty, int)
Converts a floating point number in double precision to a string.
public static string ToString(double doubleValue, PhysicalProperty physicalProperty = PhysicalProperty.NoUnit, int numberOfDigits = 2147483647)
Parameters
doubleValuedoubleThe double value to convert.
physicalPropertyPhysicalPropertyThis 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.
numberOfDigitsintOptional 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
- string
The double value as string.
ToString(int, bool)
Converts an integer value to a string.
public static string ToString(int integer, bool useGroupSeparator = false)
Parameters
integerintThe integer value to convert.
useGroupSeparatorboolIf this optional parameter is set to
true, the integer 1234567 is converted to “1'234'567”.
Returns
- string
The integer value as string.
ToString(Complex, PhysicalProperty, int, ComplexToStringConversionFormat)
Converts a complex value to a string.
public static string ToString(Complex complexValue, PhysicalProperty physicalProperty = PhysicalProperty.NoUnit, int numberOfDigits = 2147483647, ComplexToStringConversionFormat conversionFormat = ComplexToStringConversionFormat.AmplitudePhase)
Parameters
complexValueComplexThe Complex value to convert.
physicalPropertyPhysicalPropertyThis optional parameter allows you to set the PhysicalProperty used for the output. For example a complex amplitude is formatted as “1 µV/m· exp(i·2)” instead of “1e-6· exp(i·2)” if this parameter is set to PhysicalProperty.ElectricalField.
numberOfDigitsintOptional 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.
conversionFormatComplexToStringConversionFormatOptional parameter to specify the format of the complex number. If you set this parameter to
ComplexToStringConversionFormat.RealImaginary, the value is formatted as “{Real} + {Imaginary}·i”. If you set it toComplexToStringConversionFormat.AmplitudePhase(the default), the value is formatted as “{Amplitude}· exp(i·{Phase})”.
Returns
- string
The complex value as string.
ToString(PhysicalValue, int, bool, bool)
Converts a physical value to a string.
public static string ToString(PhysicalValue physicalValue, int numberOfDigits = 2147483647, bool showPhysicalUnits = true, bool prependComment = false)
Parameters
physicalValuePhysicalValueThe PhysicalValue object to convert.
numberOfDigitsintOptional 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.
showPhysicalUnitsboolIf 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”.prependCommentboolIf 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
- string
The physical value as string.
ToString(PhysicalValueComplex, int, bool, bool, ComplexToStringConversionFormat)
Converts a complex physical value to a string.
public static string ToString(PhysicalValueComplex physicalValue, int numberOfDigits = 2147483647, bool showPhysicalUnits = true, bool prependComment = false, ComplexToStringConversionFormat conversionFormat = ComplexToStringConversionFormat.AmplitudePhase)
Parameters
physicalValuePhysicalValueComplexThe PhysicalValue object to convert.
numberOfDigitsintOptional 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.
showPhysicalUnitsboolIf 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.prependCommentboolIf 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·exp(2) V/m”).conversionFormatComplexToStringConversionFormatOptional parameter to specify the format of the complex number. If you set this parameter to
ComplexToStringConversionFormat.RealImaginary, the value is formatted as “{Real} + {Imaginary}·i”. If you set it toComplexToStringConversionFormat.AmplitudePhase(the default), the value is formatted as “{Amplitude}· exp(i·{Phase})”.
Returns
- string
The complex physical value as string.