// splitLine will first split the line into a slice of strings and then
// remove from that slice those columns to be skipped. It will return an
// error if any of the columns to be skipped has an index greater than the
// maximum index into the slice.
splitLine will first split the line into a slice of strings and then
remove from that slice those columns to be skipped. It will return an
error if any of the columns to be skipped has an index greater than the
maximum index into the slice.
// splitLine will first split the line into a slice of strings and then // remove from that slice those columns to be skipped . It will return an // error if any of the columns to be skipped has an index greater than the // maximum index into the slice .
func splitLine(dfr *DFReader, state *dfReadState, df *DF) (bool, error) {
	state.cols = dfr.splitRegex.Split(state.line, dfr.maxCols)
	colsToSkip := len(dfr.skipCols)
	if colsToSkip == 0 {
		return false, nil
	}
	for i := len(state.cols) - 1; i >= 0; i-- { 
		if dfr.skipCols[i] {
			state.cols = append(state.cols[:i], state.cols[i+1:]...)
			colsToSkip--
			if colsToSkip == 0 {
				break
			}
		}
	}
	if colsToSkip > 0 {
		errStr := fmt.Sprintf(
			"%s: some skip columns are after the end of the line: ", state.loc)
		maxIdx := len(state.cols) - 1
		sep := ""
		for i := range dfr.skipCols {
			if i > maxIdx {
				errStr += sep + fmt.Sprintf("%d", i)
				sep = ", "
			}
		}
		err := dfError(errStr)
		df.addError(err)
		return false, err
	}
	return false, nil
}
func splitLine ( dfr * DFReader , state * dfReadState , df * DF ) ( bool , error ) { state . cols = dfr . splitRegex . Split ( state . line , dfr . maxCols ) colsToSkip := len ( dfr . skipCols ) if colsToSkip == 0 { return false , nil } for i := len ( state . cols ) - 1 ; i >= 0 ; i -- { if dfr . skipCols [ i ] { state . cols = append ( state . cols [ : i ] , state . cols [ i + 1 : ] ... ) colsToSkip -- if colsToSkip == 0 { break } } } if colsToSkip > 0 { errStr := fmt . Sprintf ( " " , state . loc ) maxIdx := len ( state . cols ) - 1 sep := " " for i := range dfr . skipCols { if i > maxIdx { errStr += sep + fmt . Sprintf ( " " , i ) sep = " " } } err := dfError ( errStr ) df . addError ( err ) return false , err } return false , nil }
splitLine will first split the line into a slice of strings and then
remove from that slice those columns to be skipped.
splitLine will first split the line into a slice of strings and then remove from that slice those columns to be skipped .
// work backwards from the end // remove the ith column