Questions tagged [string-evaluation]
9 questions
72
votes
13 answers
I have a string whose content is a function name, how to refer to the corresponding function in Python?
For example, if I have a function called add like
def add(x,y):
return x+y
and I want the ability to convert a string or an input to direct to that function like
w=raw_input('Please input the function you want to use')
or
w='add'
Is there any…

Bob
- 731
- 1
- 6
- 4
4
votes
1 answer
mysql is array in multiple columns
I have a string in the form $string = 'London,Paris,Birmingham' and I want to search multiple columns for occurences of these values.
For example WHERE events.name, events.cities, events.counties IN (".($string).")
Can someone recommend me a simple…

kalpaitch
- 5,193
- 10
- 43
- 67
2
votes
4 answers
PHP String Evaluation Method
Hoping one of the great minds can help me here.
I have a situation where I will receive an international phone number from a provider and I have to do a database lookup and figure out the country, region, and phone type that the phone number is…

ackerchez
- 1,684
- 7
- 28
- 49
1
vote
1 answer
Bash - Running multiple commands using string evaluation
I'm trying to create a shell script that concatenates multiple commands to a string and then execute the commands.
The following succeeds (Creates the 'y' and 'z' files and prints ls output):
$ /bin/touch /z && ls && /bin/touch /y
But the following…

Tals
- 468
- 4
- 17
1
vote
0 answers
Angular 2 Pipes with string evaluation
Inside component.ts:
var bannerContent = `
Created = ${item.created_at | date}
`;
Throws error on console: 'date is not defined.'
Following is also not working and prints as this as it is (without evaluating)
var bannerContent =…
Malik Shahzad
- 6,703
- 3
- 37
- 49
1
vote
2 answers
Ruby About loops and string equality
Why doesn't this work?
puts "Hi"
x = "stop"
loop do
a = STDIN.gets
break if a.to_s.downcase.equal?x.to_s
end
puts "bye"

darkspine
- 651
- 1
- 6
- 17
0
votes
1 answer
Ansible: How to conditional run task if a string is found?
Essentially, I am trying to use the when conditional to decide whether to proceed running a command based on the presence of a string. There seem to be all sorts of problems to overcome here, including the presence of the colon which I can't escape…

Viscosity
- 311
- 1
- 2
- 14
0
votes
1 answer
Visual Studio 2015. execute VB code from string
suppose i have this code snippet
Dim tab As String = "myTab"
Dim val As String = "field1"
Dim con As String = "...."
Dim qry As String 'should be: "Select * from " & tab & " where value = '" & val & "'"
Dim com As New OracleCommand (qry,…

mr anto
- 23
- 1
- 6
0
votes
1 answer
A switch statement doesn't work when the equivalent if statement does
switch(type)
{
case 'home':
console.log('home switch');
break;
}
The above code does not write out to the console, neither does the following:
switch(type)
{
case "home":
console.log('home switch');
…
user1017882