Click or drag to resize

DoubleVectorParse(TextReader, NumberStyles) Method

Constructs a DoubleVector instance from a given text reader using the specified style.

Namespace: CenterSpace.NMath.Core
Assembly: NMath (in NMath.dll) Version: 7.4
Syntax
public static DoubleVector Parse(
	TextReader reader,
	NumberStyles styles
)

Parameters

reader  TextReader
A text reader containing a string representation of a vector.
styles  NumberStyles
One or more number styles.

Return Value

DoubleVector
Remarks
The text representation within the reader must be of the form [ v1 v2 v3 ... ]. The data elements can be in any format that is supported by Double.Parse( string, NumberStyles ). Note that whitespace, even if set as a group separator, will be taken as a data separator.
C#
string s = "$4.52 $4.32 $4.56 $9.94 ($0.04) ($5.00)";
DoubleVector v = DoubleVector.Parse( new StringReader( s ), NumberStyles.AllowCurrencySymbol | NumberStyles.AllowDecimalPoint | NumberStyles.AllowParentheses );
s = "4.523000E+000 4.323000E+000 4.555000E+000 9.943000E+000 -4.400000E-002 -5.000000E+000";
TextReader reader = new StringReader( s );
v = DoubleVector.Parse( reader, NumberStyles.Number | NumberStyles.AllowExponent );
See Also