cancel
Showing results for 
Search instead for 
Did you mean: 
EN
cancel
Showing results for 
Search instead for 
Did you mean: 
Lingwisyer
Guru

Variable within Text

Hi all,
Figured this would similar to how it is in excel and basic but I can't figure out how to do it...

1. How do you insert a variable into a text string? eg. "1:variable_x @ A1"
2. How can you insert a text string at the end of a calculation? eg. variable_y=variable_x*5 "outlets"


Ling.

AC22-29 AUS 3200Help Those Help You - Add a Signature
Self-taught, bend it till it breaksCreating a Thread
Win11 | i9 10850K | 64GB | RX6600 Win11 | R5 2600 | 16GB | GTX1660
1 Solution

Accepted Solutions
Barry Kelly
Moderator
Lingwisyer wrote:
1. How do you insert a variable into a text string? eg. "1:variable_x @ A1"
If variable_x is a string value then you can just concatenate (add) them together.
"1:" + variable_x + "@ A1"
If variable_x is a numeric value then you have to convert it to a string.
"1: " + STR(variable_x,2,0) + " @ A1"
Lingwisyer wrote:
2. How can you insert a text string at the end of a calculation? eg. variable_y=variable_x*5 "outlets"
variable_y must be a string variable of course.
Then same as before if variable_x is a string value then you can just concatenate (add) them together.
variable_y = variable_x + "*5 outlets"
If variable_x is a numeric value then you have to convert it to a string.
variable_y = STR(variable_x,2,0) + "*5 outlets"
Or if you actually want to multiplt variable_x * 5 then
variable_y = STR(variable_x*5,2,0) + " outlets"

Barry.
One of the forum moderators.
Versions 6.5 to 27
i7-10700 @ 2.9Ghz, 32GB ram, GeForce RTX 2060 (6GB), Windows 10
Lenovo Thinkpad - i7-1270P 2.20 GHz, 32GB RAM, Nvidia T550, Windows 11

Go to post

1 Reply 1
Barry Kelly
Moderator
Lingwisyer wrote:
1. How do you insert a variable into a text string? eg. "1:variable_x @ A1"
If variable_x is a string value then you can just concatenate (add) them together.
"1:" + variable_x + "@ A1"
If variable_x is a numeric value then you have to convert it to a string.
"1: " + STR(variable_x,2,0) + " @ A1"
Lingwisyer wrote:
2. How can you insert a text string at the end of a calculation? eg. variable_y=variable_x*5 "outlets"
variable_y must be a string variable of course.
Then same as before if variable_x is a string value then you can just concatenate (add) them together.
variable_y = variable_x + "*5 outlets"
If variable_x is a numeric value then you have to convert it to a string.
variable_y = STR(variable_x,2,0) + "*5 outlets"
Or if you actually want to multiplt variable_x * 5 then
variable_y = STR(variable_x*5,2,0) + " outlets"

Barry.
One of the forum moderators.
Versions 6.5 to 27
i7-10700 @ 2.9Ghz, 32GB ram, GeForce RTX 2060 (6GB), Windows 10
Lenovo Thinkpad - i7-1270P 2.20 GHz, 32GB RAM, Nvidia T550, Windows 11

Didn't find the answer?

Check other topics in this Forum

Back to Forum

Read the latest accepted solutions!

Accepted Solutions

Start a new conversation!