Combine 2 strings for call back

i want to combine 2 global strings that i defined in my main script file one being mtVer = v1.0.1 and mtTitle = Moodys Tools reason i don't put them together and just make it one string from start is i want to be able to call both at different times for different reasons but with things like title bar i want it to be Moodys Tools v1.0.1 and such

Thanks for the help guys

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
pixamoon's picture

combine 2 strings

I'm not sure if i understand. Do you mean just combine them together ?

global mtVer = "v1.0.1"
global mtTitle = "Moodys Tools"

mtTitleVer = "Moodys Tools" + " " + "v1.0.1"

jessemoody's picture

yeah i want to be able to

yeah i want to be able to drop these into my title of the window as well as in a help file or whatever but i may just want to have it call the tool name at times or the version number.

Of course I can write a 3rd option that is global mtTitleVer="Moodys Tools v1.0.0" but i don't really want to do that.

pixamoon's picture

oki oki

oki oki

I didn't explain it well

If you have:

global mtVer = "v1.0.1"
global mtTitle = "Moodys Tools"

Than you can do:
mtTitleVer = mtTitle + " " + mtVer

mtTitleVer is a temporary variable and you can use it in rollout title

rollout aaa mtTitleVer width:200 height:200 --etc...

or

rollout aaa (mtTitle + " " + mtVer) width:200 height:200

This should explain more :)
Cheers
Pixamoon

barigazy's picture

...

@jessemoody
Avoid to use global var for this use local var instead.
Also U can use dataPair's only or array to store your two strings.

--#datapairs example
 
(
    local myTool = dataPairs mtTitle:"Moodys Tools " mtVer:"v1.0.1"
    rollout mtRoll (append myTool.mtTitle myTool.mtVer) width:200 height:200
)
--#array example
(
    local myTool = #("Moodys Tools ", "v1.0.1")
    rollout mtRoll (append myTool[1] myTool[2]) width:200 height:200
)

bga

pixamoon's picture

true

true true true

Those are much better ways to do it !
Thank you :)

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.