Depends on the type of string. For STL string objects you can use the + or the += operator. For C style strings you can use strcat(). If this is a school project and you can't use any of the standard functions/methods, then you can use a nested loop with direct assignment of elements from one string to the other (and don't forget o to put the null terminating char at the end of the string, if needed).
You are using the wrong data structure. You should use a vector, array, set or some other container than a string. With your example strings (which elements are characters) your union would be ",12345" .
If you must use a string you are going to have to break it up into its constituent parts first.
first :let us say each string length = 7 so the max result is 15
to union we will use the naive algorithm
1- copy open string into result
2-for each element in second string if it is not in the first one add to result
char string1 or
char * string1 or
Note that all three objects above could have multiple elements, each of which could be accessed using the  operator. Each element of a string is a char object. There is a default assignment operator built into the language so to assign one char to another when both are in arrays you can go:
x[a] = y;
where type would be cha, MAX could be any expression that resolves to a constant integer and a and b need not, but may be, the same value.
using namespace std;
string s1="a,b,c"; //Set up string 1
string s2="b,v"; //Set up string 2
string s3; //Setup string 3
int i=0; //init counters
string un(string s1,string s2) //function for union of two strings
s3=s1; // copy s1 into s3
c=s2[i]; // value from the current position in c
if(c!=s3[j]) // compare c with current value in s3
s3=s3+c; // conncatenate c to s3
Can somebody help me to remove the errors, i try something to do. this function should make union of two strings thanks