【お知らせ】この部分は英語原文のみでの提供となります。何卒ご了承ください。
2.1.6.12 convert_string_vector_to_int_vector
Contents
Description
convert string vector to int vector
Syntax
int convert_string_vector_to_int_vector( const vector<string> & vs, vector<int> & vn, int nNoNumericReplace = -1 )
Parameters
- vs
- [input] string array to convert
- vn
- [output] the int vector for the result.
- nNoNumericReplace
- [input] the value used to replace when a item is not a numeric. Default is 0
Return
the number of converted items
Examples
EX1
int convert_string_vector_to_int_vector_ex1() { vector<string> vs = {"-2","0","65532","127" ,"255"}; vector<int> vn; int nRet = convert_string_vector_to_int_vector(vs,vn); if(nRet) { printf("%d items converted :\n" , nRet);//Output : 5 items converted :-2 0 65532 127 255 for (int ii=0; ii < nRet; ii++) printf("%d ",vn[ii]); printf("\n"); } else printf("Convert failed"); return 0; }
Remark
See Also
convert_str_vector_to_num_vector, convert_string_vector_to_byte_vector , convert_int_vector_to_string_vector
Header to Include
origin.h