library/src/blockclass/subclasses/BP_StringUtils.cc
// Uses BuildString method to build a string containing CSV for each item.
Uses BuildString method to build a string containing CSV for each item.
Uses BuildString method to build a string containing CSV for each item .
BP_ERROR_T BP_StringUtils::buildUniqueStringStackAsCSV(BP_STRINGUTILS_BUILD_UNIQUE_SELECTION build_selection)
{
	if(!this->unique_str_cnt)
		return ERR_FAILURE;
	if(!this->unique_strings)
		return ERR_FAILURE;
	size_t n = 0;
	for(; n < this->unique_str_cnt; n++)
	{
		if(build_selection == BP_STRINGUTILS_BUILD_DOUBLE_QUOTED_CSV)
			this->BuildString((char *) "\"");
		if(build_selection == BP_STRINGUTILS_BUILD_SINGLE_QUOTED_CSV)
			this->BuildString((char *) "'");
		if(build_selection == BP_STRINGUTILS_BUILD_UNQUOTED_CSV){}
		this->BuildString(this->unique_strings[n]);
		if(build_selection == BP_STRINGUTILS_BUILD_DOUBLE_QUOTED_CSV)
			this->BuildString((char *) "\"");
		if(build_selection == BP_STRINGUTILS_BUILD_SINGLE_QUOTED_CSV)
			this->BuildString((char *) "'");
		if(build_selection == BP_STRINGUTILS_BUILD_UNQUOTED_CSV){}
		if((n+1) >= this->unique_str_cnt)
			break;
		this->BuildString((char *) ", ");
	}
	return ERR_SUCCESS;
}
BP_ERROR_T BP_StringUtils :: buildUniqueStringStackAsCSV ( BP_STRINGUTILS_BUILD_UNIQUE_SELECTION build_selection ) { if ( ! this -> unique_str_cnt ) return ERR_FAILURE ; if ( ! this -> unique_strings ) return ERR_FAILURE ; size_t n = 0 ; for ( ; n < this -> unique_str_cnt ; n ++ ) { if ( build_selection == BP_STRINGUTILS_BUILD_DOUBLE_QUOTED_CSV ) this -> BuildString ( ( char * ) " \" " ) ; if ( build_selection == BP_STRINGUTILS_BUILD_SINGLE_QUOTED_CSV ) this -> BuildString ( ( char * ) " " ) ; if ( build_selection == BP_STRINGUTILS_BUILD_UNQUOTED_CSV ) { } this -> BuildString ( this -> unique_strings [ n ] ) ; if ( build_selection == BP_STRINGUTILS_BUILD_DOUBLE_QUOTED_CSV ) this -> BuildString ( ( char * ) " \" " ) ; if ( build_selection == BP_STRINGUTILS_BUILD_SINGLE_QUOTED_CSV ) this -> BuildString ( ( char * ) " " ) ; if ( build_selection == BP_STRINGUTILS_BUILD_UNQUOTED_CSV ) { } if ( ( n + 1 ) >= this -> unique_str_cnt ) break ; this -> BuildString ( ( char * ) " " ) ; } return ERR_SUCCESS ; }
Uses BuildString method to build a string containing CSV for each item.
Uses BuildString method to build a string containing CSV for each item .
// check to ensure we have some uniqe strings // build the stack // add open quote // build the csv // add closing terminator // skip adding comma if we're at the last value // add comma on loop