Link to home
Start Free TrialLog in
Avatar of zizi21
zizi21

asked on

strcat in front

hi,

the function strcat apends the string behind but i want to append the string in front. is there a c function for that ?
thanks
Avatar of KennethBlok
KennethBlok

StringBuilder sb = new StringBuilder();  
sb.Append("sample");  
sb.Insert(0, "hello-world");  
string s = sb.ToString();
or even easier:

string s= "sample";
s = "hello-world" + s;
ASKER CERTIFIED SOLUTION
Avatar of incerc
incerc
Flag of Romania image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Deepu Abraham
sprtintf() would be a good option:

Have a look at this:

http://www.cplusplus.com/reference/clibrary/cstdio/sprintf/
char buffer [50];
  char str1[]="Experts-";
  char str2[]="Exchange"
  n=sprintf (buffer, "%d%d",str1,str2);
  printf ("The output is [%s]\n",buffer);

Open in new window

SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial