Jump to content
Sign in to follow this  
Przemek_kondor

How to concat two string in description.ext?

Recommended Posts

Hi

I have some string variables created in stringtable.csv.

Is there way to concat them and use in description.ext as titleParam1 or in textsParam1[] ?

For example I have $STR_LOCATION (in english: "Location") and $STR_DAYTIME (in english "Day time") and I want to get: "Location | Day time"

Share this post


Link to post
Share on other sites

I have used __EVAL in classes for that, so it might work here. See BIKI

You could try:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">x_EVAL( $STR_LOCATION + $STR_DAYTIME )

LOL. This forum actually tries to parse the code, so the "x" is really another underscore, making it a double underscore prefix.

Share this post


Link to post
Share on other sites

very strange, these:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">titleParam1 = EVAL ("string1" + " string2");

and

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">titleParam1 = $STR_DAYTIME;

and

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">titleParam1 = $STR_LOCATION;

work

but this one:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">titleParam1 = EVAL ($STR_LOCATION + $STR_DAYTIME);

doesn't work

(of course EVAL has two undercore prefix: __EV... but forum parses it)

Share this post


Link to post
Share on other sites

I'd image that:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">titleParam1 = _EVAL ($STR_LOCATION + $STR_DAYTIME);

Turns into:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">titleParam1 = "$STR_LOCATION$STR_DAYTIME";

After config processing. I'm guessing the $ gets evaluated after this step.

Note, that there are always quotes added around $ strings anyway. So this line:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">titleParam1 = $STR_DAYTIME;

Is really the same as this line:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">titleParam1 = "$STR_DAYTIME";

My suggestion? Simply make a new string in your stringtable. Ex:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">titleParam1 = "$STR_DAYTIME_AND_LOCATION";

Share this post


Link to post
Share on other sites

You can use variables and most scripting commands in the description.ext.

Together with _EXEC, it gives you pretty good flexibility:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_EXEC(_str=localize "STR_LOCATION" + " | " + localize "STR_DAYTIME");

text = _EVAL(_str);

(Of course, use double-underscores before EXEC & EVAL in your real code.)

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×