Game Development Community

String concat

by AIDan · in Torque Game Engine · 05/15/2002 (4:25 am) · 3 replies

Could someone please explain these operations to me?

NL
?

SPC
I think it has something to do with the language and translation.

greetings
Daniel

#1
05/15/2002 (5:01 am)
@ String concatenation operator: "Hello " @ "World!" == "Hello World!"
TAB String concatenation with a tab. "Hello" TAB "World!" == "Hello\tWorld!"
NL String concatenation with a newline. "Hello" NL "World!" == "Hello\nWorld!"
SPC String concatenation with a space. "Hello" SPC "World!" == "Hello World!"

? isnt one afaik.

unless your referring to something like this:

istrue() ? itstrue = true : itstrue = false;

which is basically a one line if statement..the above is the same as:

if (istrue()) {
itstrue = true;
} else {
itstrue = false;
}

-Tim aka Spock
#2
05/15/2002 (7:15 am)
As we are talking about string. Am I right when I say that string delimited with ' will be tagged string (and transmitted to the client with a tag) and string delimited with " will not be tagged and transmitted to clients like that (every character) ?
#3
05/15/2002 (8:09 am)
@Tim:

I've always seen that as
istrue = istrue()?true:false;
but then that would be easier done as
istrue = istrue();
Your statement would work fine tho.

Mebbe a better example would be an abs() function:
function abs(%val)
{
    return (%val < 0)?-%val:%val;
}
which is the same as
function abs(%val)
{
    if (%val < 0)
        %val = -%val;
    return %val;
}