1
vote
6answers
78 views

String comparisons not returning correctly? [duplicate]

import java.util.Scanner; public class Poop { public static void main (String args[]){ Scanner input = new Scanner(System.in); String Gender; System.out.println("Are you a boy or a ...
-3
votes
0answers
16 views

Changing Variable Value with MC Name [closed]

I have a form with a variety of buttons available for selection. I already have variables set up for each item on the main timeline...let's call them: send_apples send_pears send_oranges The buttons ...
1
vote
1answer
25 views

Script to search for a value and create a variable dynamically?

Sorry if the question in the title is a bit vague, here's what I'm trying to accomplish: Is there a script out there that can search a page (or page source) for a particular determined value (for ...
-2
votes
1answer
40 views

PowerShell Consider Variable as String

$ConfigFile = "C:\Outils\Config.ps1" $Keys = Get-Content $ConfigFile | Foreach {($_ -split '\s-',4)[0..2]} $Keys = Get-Content $ConfigFile | Foreach {($_ -split '=+',4)[0..2]} ForEach($mot in ...
0
votes
6answers
42 views

php: How to find a string in a paragraph

Let's say that I have: $strPar = "This is a simple paragraph that we will use for the questioning"; $strFindMe = "that"; How will I check if $strPar contains $strFindMe?
0
votes
2answers
28 views

PHP variable interpolation vs concatenation [closed]

What is the difference between the two following methods (performance, readability, etc.) and what do you prefer? echo "Welcome {$name}s!" vs. echo "Welcome ".$name."!";
0
votes
1answer
28 views

Batch: How to append the name of a variable instead of the value of that variable

I am trying to append strings to a text file. So far, my code looks like this: echo -%appointment% >>C:\Users\Evan\Desktop\Programming\Events.txt echo set /a h=(%hours%*3600)+(%minutes%*60) ...
0
votes
7answers
40 views

Join string and variable to get another variable in PHP

Sorry if this has already been asked, but it's hard to search for it... I tried googlin this topic without success. What I want to do is this: $layoutColor = 2; $colors1 = array ("F57171", ...
0
votes
1answer
47 views

Flex - RegExp replace is not working using variable

Must be simple fix but I cannot see for the life of me what I'm doing wrong. I've tested the reg expression in an online tester and it works, so assuming it's Flex dependent problem. Here's my code ...
0
votes
1answer
34 views

Smarty - Output HTML Variables

I cant understand how Smarty proceed with PHP string variables, with HTML tags: If I type: $string = '<b>Hello World</b>' $smarty->assign('STRING',$string); The result is Hello ...
3
votes
2answers
38 views

bash read a character from every string in file

I have not so easy task and I am in need of useful advice. I have a file, containing list of hosts: host1.example.domain.com host2.example.domain.com host3.example.domain.com and a variable in a ...
0
votes
1answer
14 views

how to concatenate (part of) variable to String in XSLT

I would like to see the first couple of characters of the variable 'vari' to be concatenated to String abc=' here: href="{concat('abc=', substring-before('vari', '='))}" Here is the whole snippet: ...
2
votes
1answer
96 views

select the right type of variable C#

i want to create pi more than 16 thousand numbers after the decimal point but the problam is that i kant find any type that could fill my wishes. I tried to use object but it rounds the number after ...
2
votes
4answers
66 views

Jquery check if both values are starting with same text

I jquery how to check two values starting with same texts, My code is $a = "Hello john"; $b = "Hello peter"; $a == $b --> False Like this how to find variables staring string.
0
votes
5answers
45 views

Strings with embedded variables in Python

Maybe some already asked this but I didn't find it and I wanted to know how to embed variables into a string in Python. I usually do it like this: print('Hi, my name is %s and my age is %d' %(name, ...
0
votes
2answers
56 views

Access an array according to a NSString's value

In my app the user has twelve buttons available, and I have defined twelve NSMutableArrays. If the user clicks button one, the app should count the number of objects in the Comp1 array, or if user ...
2
votes
2answers
65 views

How to use argument of a function as name of variable?

I have the feeling that this is trivial, and I apologize for asking such easy questions, but I would appreciate some help with the following problem: I have a function which requires two arguments: ...
0
votes
1answer
37 views

Powershell - Syntax error - pasting string from a function into “-Filter”

Here is my code: I try to build a filter string in a function and us it in and get-adobject command, but I get an syntax error an position 1 function build-filter ([string]$searchName) { $searchName ...
1
vote
2answers
43 views

Linux awk string exec variable

i have a variable that when i echo it looks like this: #echo $var awk '{print $7 " " $6 " " $8 " "}' but if I try something like #ls -lah | exec $var awk: '{print awk: ^ invalid char ''' in ...
-5
votes
0answers
77 views

JAVA String variable isn't initialized inside of SWITCH-CASE block [closed]

[JAVA] String variable isn't initialized before the IF. salType is not initialized in this line: String salType = new String (reader.readLine()); but if we try to compile and work the code inside ...
0
votes
2answers
44 views

How do I randomly jumble a string imploded by ',' in PHP (ex: a,b,c = c,b,a) in a oneliner?

How do I randomly jumble a string imploded by ',' in PHP (ex: a,b,c = c,b,a) in a one-liner? Here is an example srand((double)microtime*1000000); $foo=array( a => "a", b => "b", c => ...
0
votes
1answer
16 views

Getting a usable variable name from within another variable

I'm developing a little* android app and have 9 buttons and 9 images, each named button_# and img#.png My question is simple, is their a way that I can take an int whose value is between 1 and 9 and ...
1
vote
2answers
69 views

print variable “$1” as string in bash script

I want to print string called "$1". But when I do this with echo it prints string which equals to "$1" variable. How can I print "$1" just like string? for example: $1 = "output" echo $1 ==> ...
0
votes
1answer
37 views

Save Global variable or a php like session

I'm working on my app but i need some help. I need a 'php-like session' in Objective C (without using connection to the internet) I've thought about global vars, but my app seems to reset them when ...
3
votes
1answer
69 views

POST vars from flash to php file_put_contents filename

I'm recording webcam data and sending to a .php to be stored and viewed later within the flash. That element is working fine but I need to give the file a unique ID each time it does this based on ...
0
votes
3answers
41 views

PHP variable value from string

How can I get value from variable which is string ? $Member_Student = 3600; $selectedItem = "Member_Student"; $price = "$" . $selectedItem; print_r($price); //prints $Member_Student instead of ...
0
votes
5answers
50 views

Take question mark off end of string in PHP

I'm new to php, but wasn't able to find a straight answer online, so decided to ask Stack Overflow. I have a variable, and I want to make a statement similar to the following: if ($var has a ...
0
votes
1answer
53 views

Broken PHP script - fwrite and variables

Processing $_POST data through the following PHP script with 'mike' and 'tampa' being the post data: <?php $name = $_POST['name']; $city = $_POST['city']; $fh = fopen('variables.php', 'w') or ...
0
votes
2answers
47 views

Want to pass varialble in string variable in php

I want to pass variable in string so that later in script value is assigned to it. $message="hi $(name) your salary $(salary) is credited in your XYZ account"; foreach($arrmsgvar as $key => ...
3
votes
1answer
42 views

looking up strings in different columns in R

I have a dataset of 4 columns with hundreds of rows, here's a little sample: A B C D V1 V2 V100 V4 V15 V5 V6 V100 V8 V3 V9 V10 V3 V11 V12 V13 ...
1
vote
3answers
40 views

JavaScript - How do I extract string in If/Else statement

I'm trying to use the If/Else statement to write certain text on the screen after searching through the imgNumber variable. For some reason, it only writes the string 'cockroaches' no matter which ...
0
votes
1answer
57 views

Python3: string to variable

I've looked everywhere for this but haven't found a suitable answer yet and I don't want to use a dictionary. How can I convert a string to a variable name? For example I have this call: ...
0
votes
1answer
33 views

How do I check if a certain set of words is in a string with PHP

So I have this code below but I am wondering how I can tell if '$text' contains the words 'by owner'. How do I do this? I looked around but I can't find anything. foreach($anchors as $a) { $i ...
0
votes
4answers
45 views

How do I make each word in a string a variable with PHP

How do I make each word a separate variable if the string contains 3 words? I searched and searched but I have found now tutorial on how to do this. Any help would be greatly appreciated.
-3
votes
3answers
98 views

execute string as variable with php's eval() [closed]

What is the right way to use php's eval() function in case of the following string or what would be the right alternative on eval() I try to build a dynamic CSV parser which assigns CSV columns to ...
1
vote
3answers
81 views

Matlab: Create Variables with names from strings

Let's assume that I want to create 10 variables which would look like this: x1 = 1; x2 = 2; x3 = 3; x4 = 4; . . xi = i; This is a simplified version of what I'm intending to do. Basically I just ...
0
votes
0answers
20 views

Like in Multple String Variants [duplicate]

I have looked at the duplicate question and have gone through the answers - but they are not working in this case. Below is the code that I have tried and also the results - why is it bringing back ...
1
vote
2answers
51 views

Extract Digits From String After Capturing It From File

I'm trying to retrieve a memory value from file, and compare it to reference value. But one thing at a time.... I've attempted using set/source/grep/substring to variable but non of them actually ...
0
votes
2answers
30 views

Shell Script Variable Manipulation

I've got this script: for f in "$@" do q=${f#*Media/Music/} echo q done All I want to do is set q to f after Media/Music/. But it just echoes nothing. If I do echo "${f#*Media/Music/}" ...
-1
votes
3answers
45 views

PHP 'nothing' character

I like embedding variables in strings - "I like $verb $noun in strings!" But then I was designing a database access script: $sqlfragment = "SELECT * from " . $databasetableprefix . "_user"; ...
2
votes
1answer
45 views

Trying to call a Sub with a String - VBA

I have the following code. I cannot for the life of me figure it out. I want to call a different sub depending on the value of "i". For example, if i=1 it should call sale_call1 and if i=2 it ...
0
votes
2answers
61 views

Variable inside a String inside a String

I'm running into a little problem when I try to put a variable inside a string that's already inside a string. Basically, I'm trying to change the color of a specific word with a color variable (a ...
0
votes
2answers
83 views

Using a variable with a dollar sign in it in bash

I have a variable that contains a string with $ dollar signs in it and I want to use sed to modify a text file. I get an error whenever there is a dollar sign in the variable but it works fine when ...
0
votes
1answer
58 views

Variable string in string in variable ?? PHP

I am coding a reoccurring sql select with a varying clause. In the clause i have a PHP variable (supposed to be replaced later within a WHILE. My code: $custaccount_id_clause = "(SELECT ...
0
votes
2answers
76 views

How to insert " character in string variable?

How to insert this? Dim SpCharacter As String = " " " or Dim XMLSitemap As String = "<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" ...
0
votes
2answers
207 views

Delphi 7 Function - String or ShortString? Integer or Word? [closed]

I am a "performance" enthusiast programmer, and have a basic theoretical question: Does Delphi 7 has some "way" to identify the kind of string used and automatically define the correct type? For ...
0
votes
1answer
13 views

Get numbers from string - php

I have this string: subcategory19,category1 And I want to get from it these values: 19 1 in two separate variables. I tried many ways, out on the internet, but I couldn't do it with ...
0
votes
3answers
64 views

Best way to seperate two strings from a variable

I have managed to retrieve the data I'm looking for which is in the form of two urls and I need to extract them into two separate variables. Am I retrieving the data the most efficient way and how can ...
-1
votes
2answers
96 views

How can you run code stored on a string variable on C#? [duplicate]

I'm kind of new with C#. I was just wondering if there's a way to run code stored on a string var, for example: string var = (int num = num1 * num2).ToString(); I read in another question it's ...
-4
votes
3answers
33 views

i have a php variable that i have to display the length of as a 3 digit number that is right aligned [closed]

this is a really noob question I guess, but I am very new to php and have no idea how to even begin this one, basically I have a set of $vars that I have to display the length of as a 3 digit number ...

1 2 3 4 5 11
15 30 50 per page