Tagged Questions
1
vote
1answer
26 views
How do I convert string variables to numeric variables in Stata?
I have two variables in Stata, both numeric variables that have somehow been recorded as string variables. I need them converted to numeric variables so that I can generate a new variable with them.
...
2
votes
4answers
44 views
Check string to find variables inside (PHP)
I need to read an string to find variables (tags) and replace it with stored values.
I used % (percent) to identify the tags. The input should accept some tags like %color% and %animal%, so with PHP ...
-1
votes
0answers
29 views
testing a string variable for specific value (in HTML template file) [on hold]
I need to test for a specific value of a string variable, inside an HTML template file.
For numeric variables, I use the following code structure with success
<!-- if numeric_variable == 1 ...
0
votes
2answers
30 views
C: Assigning string variable using precision specifiers like printf
I want to assign a string variable using precision specifiers like printf uses and without using a ton of for loops. The code is passed in a date from the command line in the form of YYYYMMDD. To ...
5
votes
3answers
121 views
Using intern in java Strings
I am trying to understand Java's String class but I am having a hard time understanding the situation described below.
Consider the following example snippet:
String x = new String("Hey");
String y ...
1
vote
2answers
28 views
JS replacing all occurences of string using variable [duplicate]
I know that str.replace(/x/g, "y")replaces all x's in the string but I want to do this
function name(str,replaceWhat,replaceTo){
str.replace(/replaceWhat/g,replaceTo);
}
How can i use a ...
0
votes
0answers
17 views
Importing string from text and run file
Hi i dont know much of VBS so i was wondering if you can help me, it should be really easy for you. I have a file which has some numbers (text file). I'd like the script to read the first 2 ...
-9
votes
4answers
83 views
unable to cout string in C++ [closed]
I am new to programming and I can only use C++. I have been working on an RPG, and for some reason I can't get the program to print out the value that I set a string to. I started by defining the ...
0
votes
1answer
61 views
Calling a variable with a string [duplicate]
I have many dataframes (week1, ..., week20) and I want to call them in a loop:
for (i in 1:20) {
function(weeki)
}
Intuitively, I want to do something like this:
weeki <- paste ("week", i, ...
1
vote
3answers
68 views
How to transform a string into multiple variables
Is there a way to transform a string into multiple variables?
If I try:
string = "string1 string2 string3 string4"
string.split(" ")
I know that I will get an array:
=> ["string1", "string2", ...
0
votes
1answer
28 views
Referencing a RegEx Variable
I'm using python to loop through a large list of self reported locations to try to match them to their home states. The RegEx expression I'm using is:
/^"[^\s]+,\s*([a-zA-Z]{2})"$/
Basically, I'm ...
2
votes
1answer
32 views
batch expansion variable cannot be used in substring replace function
im beginner, my task is something to do with renaming files in folder, first of all here is a piece of my code:-
setlocal enabledelayedexpansion
set tempLogDate=0
set g=0
for /r %targetStore% %%i ...
-2
votes
1answer
56 views
python replace records in variable [closed]
I have:
x = "abcdefghi", and I want to replace record from that variable with another record.
for example:
x = "abcdefghi"
x.replace(x[1], x[1+2]), and I want to do a such thing to all records in ...
0
votes
1answer
44 views
PHP - How to get the string between two specific characters
I got now a two sides that contains numbers and between two specific numbers there is a string that shows a group of numbers, Let's say we got this 123456789$numbers1234567 and I want to get the ...
0
votes
1answer
39 views
Getline string input to create a word
I have a program that receives an input and goes character through character to avoid white spaces. What I need to do now is get each one of those characters that aren't white spaces and stores them ...
1
vote
1answer
25 views
HTML variable inside of String
I'm building a website with Django. I want to have a string url [already done], but I want the string to be changeable based on variables.
sudocode:
variable a = "Hello"
url = "www.facebook.com/a" ...
0
votes
2answers
25 views
PHP - mixed strings and variables with addition on the var?
What am I doning wrong in my formatting for these 2 bits of code?
How can I format the mixture of strings and vars to give me the proper output?
$inbody = 60;
$body = "Welcome. For about " . $inbody ...
1
vote
4answers
62 views
Embed variables in a string
I want to use a variable in a string but I don't know how.
Here is my code:
private AbstractAction tester = new AbstractAction("test love match") {
@Override
public void ...
0
votes
1answer
49 views
Telnet with PHP - it works just with echo?
I'm using PHPTelnet.php class (http://www.geckotribe.com/php-telnet/) to get WAN IP from my router via telnet command. It goes like this:
require_once "PHPTelnet.php";
$telnet = new PHPTelnet();
...
-1
votes
1answer
18 views
Conditioned URL masking
Say I have two domains from two different servers. A.com which people visit, and B.com which hosts the files they view.
When a person views A.com/file they are actually viewing B.com/file.
Of course ...
1
vote
1answer
36 views
autohotkey assign a text expression to a variable
In an autohotkey script I was trying to assign a text string to a variable. Can anyone spot why this doesn't work, it looks just like some provided examples? I don't need the variable anymore, but ...
0
votes
2answers
40 views
Automated file rename - const variable is changing its value?
I'm kind of a noob with the std namespace, and I'm writing code that loops through all the jpeg files in a directory and removes any exclamation points. I'm trying to use std::string and std::vector. ...
0
votes
2answers
68 views
Getting variable from another namespace not working
I'm trying to get a variable (string) from another namespace. I tried many possibilities, but none of them succeed.
namespace CPLoader
{
public class dbC
{
public string _CS { get; ...
0
votes
0answers
39 views
VBA Concatenating Variables - Best Practices
I have found both " " + " " and " " & " ".
Are there any other ways to concatenate variables? If so, apply them to the next question please.
Which concatenating is best practice and why? What ...
0
votes
2answers
54 views
php extract variable name from string, sort of like javascript eval
I would like to declare a string containing a variable name in it, and then have php be able to identify that variable from within the string, like a javascript eval. Examples:
This code works, ...
1
vote
2answers
33 views
Use the content of a string for a variable referencing a picture Android/Java
i got this :
String input = "image_to_show"
and in my drawables:
image_to_show.png
i do:
imageView.setImageResource(R.drawable.image_to_show);
this works and refers to the object in ...
0
votes
2answers
51 views
How to use the context of a string as a variable java
So I have the following :
String string = "camera_icon"
and in another place I have:
Object camera_icon = new Object();
i then refer to it as:
do.some.stuff(camera_icon);
is there a way that ...
0
votes
1answer
48 views
Can't fix this one annoying error! :L
So, I'm a newcomer to Python.
We've started covering it in school and I'm having some issues.
I'm attempting to create a quiz in python with a points system. The points system works for the first ...
5
votes
4answers
102 views
remove a space from a perl variable
I am having a lot of trouble doing a simple search and replace. I tried the solution offered in
How do I remove white space in a Perl string?
but was unable to print this.
Here is my sample code:
...
0
votes
2answers
37 views
Cant mail a couple of variables and strings
So I am developing a script that will eventually be run as a shell to detect ip address changes by comparing the current ip (
//get_ip.php
<?php
$current_ip = ...