Actually passing an iterator also wont do. I have vectors of different struct types. A "space separated" string is stored in one of the struct variables (all of type string) in each vector. I have to remove spaces from the "space separated" string and replace it with a comma to make it a csv string but except at one place i-e I want to keep that substring still a "space separated" string and I have also stored that "space separated" string separately in one of the struct elements.
e-g
The code below works fine but I dont know how to keep that specific substring still a "space separated" string.Code:element-1"space separated" string part of the string: "abc 123" which is for example the fifth/sixth substring in the example below element-2 of vector-structtype-1: "shnd 23j l94 hsi8 abc 123 md38 fhw0 8fdj" csv element-2 of vector-structtype-1: "shnd, 23j, l94, hsi8, abc 123, md38 fhw0 8fdj" element-1 of vector-structtype-2: "space separated" string part of the string: "klm 987" which is for example the fifth/sixth substring in the example below element-2 of vector-structtype-2: "dnhs j32 49l 8ish klm 987 83dm 0wfh jdf8" csv element-2 of vector-structtype-2: "dnhs, j32, 49l, 8ish, klm 987, 83dm, 0wfh, jdf8"
Code:void liffe_breach::CSVline(int Count, int ordIDno, string str) // I want this str to be an elements of a specific vector. Is it possible? { // because vectors are of different (struct) types std::stringstream Brchno; Brchno << Count; std::stringstream IDno; IDno << ordIDno; stringstream ss(str); string word; string cvsLine = ""; while ( ss >> word ) { cvsLine = cvsLine + word + ","; } }




Reply With Quote