SA-MP Forums Archive
Combining two strings together - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Combining two strings together (/showthread.php?tid=385854)



Combining two strings together - Deal-or-die - 18.10.2012

G'day,
I am aware you can use strcat to combine two strings into one.
however I am not 100% sure It's what I want haha.

I would like
pawn Код:
//
                    format(string3, sizeof(string3),"%s", string1);
                    format(string3, sizeof(string3)," with %s.", string2);
                    ShowPlayerDialog(playerid, 169, DIALOG_STYLE_MSGBOX, "Joint Strings", string3, "Finalise","Back");
would it be something like.
pawn Код:
//
                    format(string1, sizeof(string3),"%s", string1);
                    format(string2, sizeof(string3)," with %s.", string2);
                    strcat(string1, string2, sizeof(string1));
                    ShowPlayerDialog(playerid, 169, DIALOG_STYLE_MSGBOX, "Joint Strings", string1, "Finalise","Back");



Re: Combining two strings together - cosbraa - 18.10.2012

I don't actually fully understand.
But if you don't want strcat you could do something like:
Код:
format(string1, sizeof(string3), "%s with %s", string1, string2);
Not sure if I understand you, though.