Hi,
I am pretty new to this group.
I hope one of the Mathcad experts can help me.
say I have two variables with text as output
a1 = "text1"
a2 = " text2"
How can I decalre these two text variables side by side in programming
a3 = "text1" "text2" if ....
this doesnt work. is there any specific syntax to declare a1 and a2 side by side
Cheers
Solved! Go to Solution.
Look in help, the index, under string functions.
You're looking for "concat"
Hello!
You need to use the built-in function "if":
Thanks for the quick response
But that is not what I am looking for
I need an output with two text variables side-by side
say a1= "Hello"
a2 = "I am fine"
then the output should be
a3= Hello- I am fine
not just "Hello" or either "I am fine". Want both variables.
I guess there must be some syntax to declare the text variables side by side
Look in help, the index, under string functions.
You're looking for "concat"
Hi Fred,
Awesome, thanks a lot. That fixed my problem
Cheers
As an aside, if you prefer the look of the VB "&" string concatenation operator, you can define a function named "&" in Mathcad and use it in a visually similar fashion to VB by means of the infix operator (nesting the infix operator as required).
Using "&" means using the "text in math" facility .... type a letter (doesn't matter what), then press ctl-shft-k - the cursor should turn red. Now type "&" and the & character will appear (rather than an integral operator as normal), press ctl-shft-k again to end "text in math" mode and delete the first letter. Now type "(a,b), ":" to get the definition operator, followed by "concat(a,b)". You now have a function called & that does the same thing as concat (except that it can only take 2 arguments).
The infix operator (available from the Evaluation toolbar) allows you define function f(x,y) in the form "x f y" (eg, the vector cross multiplication function x(a,b) could be written a x b). Similarly, you can use "str1 concat str2" or, with the new & function, "str1 & str2".
Stuart
Guys, you are awesome,so much technical helpful stuff. Thanks Bruff for this suggestion
Cheers