2.1.7.10 okutil_parse_row_range


Description

parse a row range portion of a range string to break down to its components. Caller must initialize all output arguments to i1=-1 and bAuto1 = false etc.

Syntax

BOOL okutil_parse_row_range( LPCSTR lpcszRowrange, int * pi1, BOOL * pbAuto1, int * pi2, BOOL * pbAuto2 )

Parameters

lpcszRowrange
[input] empty string means full range, or [1:end] as full range, otherwise can be [4:5], [5*:10] with * to indicate auto
pi1
[output] when not NULL, receive the row begin index (0 offset) so [1:4] will lead to *pi1 = 0
pbAuto1
[output] when not NULL will set to true if beginning part of row range is auto (or full range)
pi2
[output] when not NULL, receive the row end index (0 offset, inclusive) so [1:4] will lead to *pi2 = 3
pbAuto2
[output] when not NULL will set to true if ending part of row range is auto (or full range)

Return

false if lpcszRowrange is not empty and does not conform to standard row range string notation

Examples

EX1

void okutil_parse_row_range_ex1()
{
    string strRange =" [1:4*] ";
    BOOL  pbAuto1 = false;
    BOOL pbAuto2 = false;
    int pi1 = -1;
    int pi2 = -1;
    bool bRet = okutil_parse_row_range(strRange, &pi1, &pbAuto1, &pi2 , &pbAuto2);
    if(bRet)
    {	
		if(pbAuto1)
			printf("beginning part of row range is auto  \n");	
		if(pbAuto2)	
			printf("ending part of row range is auto  \n");
		printf("the rows range  from  %d  to %d (0 offset)\n" , pi1 , pi2);
    }
}

Remark

See Also

Header to Include

origin.h

Reference