Questions tagged [variable-substitution]

This tag is misspelled. variable-substitution is correct. `t` is missing. This is the process of evaluating a string literal containing one or more placeholders, yielding a result in which the placeholders are replaced with their corresponding values.

74 questions
0
votes
2 answers

Variable substitution within a string

I'm trying to come up with some very reusable code that will look up and perform variable substitutions within a string. The example string below contains a $$ reference to a variable. Format is varname.key. I want the subText() function to be…
Dan
  • 2,304
  • 6
  • 42
  • 69
0
votes
0 answers

Variable Subsitution When Using Django?

Currently, I use the following code to include another HTML file: {% include "machines/opennebula/resources.html" %} I am adding another folder to add another version of resources.html (specifically to support OpenStack when I want to swap to…
MRichards
  • 86
  • 1
  • 5
  • 15
0
votes
1 answer

Javascript variable substitution

I have an array daysoftheweek:['Monday', 'Tuesday','Wednesday', 'Thursday', 'Friday','Saturday', 'Sunday'], Also I have functions function totalMonday() {} function totalTuesday() {} Can I use variable substitution to call…
LeBlaireau
  • 17,133
  • 33
  • 112
  • 192
0
votes
2 answers

Tcl SQLite update variable substitution cannot have apostrophe

Here's the problem: if I use { } for the update command like so: package require sqlite3 fileRepo eval {UPDATE uploads SET $col=$data WHERE rowid=$id} I cannot substitute any variables inside the curly brackets. it all has to be hard…
MetaStack
  • 3,266
  • 4
  • 30
  • 67
0
votes
1 answer

Use string as bash variable name in alternative value expansion

How can I use the value of one variable as the name of another variable in an alternative value expansion (${var+alt}) in bash? I would think that #!/bin/bash cat='dog' varname='cat' if [ -z ${`echo "${varname}"`+x} ]; then echo 'is…
Chris Middleton
  • 5,654
  • 5
  • 31
  • 68
0
votes
1 answer

Variable Substitution in KML Icon Reference

How can I do variable substitution in a kml icon reference? I'm using Google Earth to load the kml, and my image doesn't appear for this simple example:
Boundless
  • 2,444
  • 2
  • 25
  • 40
0
votes
2 answers

Use return value of function call in PHP heredoc in Yii?

I'm trying to html encode a string that will be used as a tooltip in a google map. $cs = Yii::app()->getClientScript(); $cs->registerScript('someID', <<
User
  • 62,498
  • 72
  • 186
  • 247
0
votes
1 answer

Ruby each loop x to variable substitution

<% @parts.each do|x| %> <% @bbb = Relation.where(part: "#{x}") %> <%= **@"#{x}"** = @bbb.collect {|x| x.car} %> <% end %> I'm trying to set the variable in line 3 to the x part value @"#{x}". I can't find the right syntax. I know about send(x)…
San Backups
  • 515
  • 9
  • 17
-1
votes
2 answers

Linux bash; manipulate PATH type var

Linux debian bash. I have a PATH type variable 'X' that I want to manipulate. 'X' can be any number of elements delimited by ":" For example, using fruits: set X=apple:pear:orange:cherry How might I extract the first element minus its delimiter,…
keratos
  • 15
  • 8
-1
votes
1 answer

##[error]Error: NO JSON file matched with specific pattern: **/appsettings.json

I'm trying to deploy an Azure App Service using Azure Devops. I'm using the Task Azure App Service deploy version 4.* I started noticing the following error in the log recently with the deployment failing (saw it first on 24th September) Applying…
Alen Alex
  • 897
  • 4
  • 15
  • 31
-1
votes
1 answer

How to substitute values in a key-value file if keys exists in shell environment?

I have a file like below with key value pair separated by =. I have already exported some variables to my shell. Now I want a shell script which can substitute the values for its corresponding keys if those keys are already exist in env variables or…
SkyRar
  • 1,107
  • 1
  • 20
  • 37
-2
votes
2 answers

How to expand array in Bash adding double quotes to elements?

I would like to pass an array to a function and use the values in the array as a command parameter, something like this: command can receive N parameters, example: param1 param2 oneparam 1 a 2 b 3 c onotherparam my_func() { command param1 param2…
user5507535
  • 1,580
  • 1
  • 18
  • 39
-2
votes
3 answers

How to avoid variable substitution in Perl regex?

I have the following regex: my ($pkg) = ( $xmldirname =~ /$db(.*)^/ ); What it should do is: check if the xmldirname starts ($) with "db" and take the rest of the string into $pkg. What it does is: "Global symbol $db requires explicit package…
jackthehipster
  • 978
  • 8
  • 26
-4
votes
1 answer

Excel Summing Un-Formatted Numbers

I'm trying to find an average of a large array of candidates compensation. Some of the cells contain text with multiple numbers showing a range such as, "$100k - $120k". Others are labeled as TC("120k TC") for total composition. How would I be able…
1 2 3 4
5