// ------------------------ operator[] ------------------------------ public CsvString.Value this[int InValueIx] { get { CsvString.Value v = null; if (CurrentValueNx == InValueIx) { v = CurrentValue.Clone( ); } else { if ((CurrentValueNx >= InValueIx) || (CurrentValueNx == -1)) { BeginValue( ); } while (true) { v = NextValue( ); if (v == null) { break; } else if (CurrentValueNx == InValueIx) { break; } } } return(v); } }
// --------------------------- Empty ------------------------------ private CsvString Empty( ) { mCurrentValue = null; mWip = null; mValueCx = -1; mString = null; return(this); }
/// <summary> /// Position at begin of sequence of comma delim values. /// </summary> /// <returns></returns> public CsvString.Value BeginValue( ) { mCurrentValue = new CsvString.Value( ); mCurrentValue.CsvString = this; mCurrentValue.BeginValue( ); CsvString.Value vlu = mCurrentValue.Clone( ); return(vlu); }
/// <summary> /// advance the CsvString value cursor to the next value. /// </summary> /// <returns></returns> public CsvString.Value NextValue( ) { CsvString.Value vlu = Clone( ); vlu.AdvanceNextValue( ); if (vlu.IsAtValue == true) { return(vlu); } else { return(null); } }
public CsvString.Value NextValue( ) { if (mCurrentValue == null) { BeginValue( ); } mCurrentValue.AdvanceNextValue( ); if (mCurrentValue.IsAtValue) { return(mCurrentValue.Clone( )); } else { mCurrentValue = null; return(null); } }
public string[] ToStringArray( ) { string[] arr = new string[Count]; CsvString.Value vlu = BeginValue( ); int Ix = 0; while (true) { vlu.AdvanceNextValue( ); if (vlu.IsAtValue == false) { break; } arr[Ix] = vlu.ToString( ); ++Ix; } return(arr); }
/// <summary> /// private function ( for now ). Add a string, as is, to the CsvString. /// </summary> /// <param name="InValue"></param> private void AddString(string InValue) { // adding a value to string invalidates the current value cursor. mCurrentValue = null; mValueCx = -1; // switch to wip mode. if (mWip == null) { mWip = new StringBuilder( ); if (mString != null) { mWip.Append(mString); mString = null; } } // add the value to the string. if (mWip.Length > 0) { mWip.Append(", "); } mWip.Append(InValue); }