Jump to content


Photo

Variables in strings?


  • Please log in to reply
3 replies to this topic

#1 Bloxtra

Bloxtra

    GMC Member

  • GMC Member
  • 134 posts
  • Version:GM8

Posted 10 April 2012 - 08:47 AM

Hi,
I was just wondering if it was possible to put a variable in a string, e.g.

playname = "Bob"

string = playname ": Hello there!"

How would i do this?
  • 0

#2 Tsn

Tsn

    GMC Member

  • GMC Member
  • 281 posts
  • Version:Unknown

Posted 10 April 2012 - 08:57 AM

variable = string(playname)+": Hello there!"
  • 0

#3 MasterOfKings

MasterOfKings

    The True Master

  • GMC Member
  • 4888 posts
  • Version:GM8

Posted 10 April 2012 - 09:00 AM

str = playname + ": Hello there!";
All you needed was a plus.

Edited by MasterOfKings, 10 April 2012 - 09:00 AM.

  • 1

#4 Bloxtra

Bloxtra

    GMC Member

  • GMC Member
  • 134 posts
  • Version:GM8

Posted 10 April 2012 - 09:34 AM

Thanks, works beautifully!
  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users