Update
If you were forced to use a single char on a split method, which char would be the most reliable?
Definition of reliable: a split character that is not part of the individual sub strings being split.
I have a data set that I import into a SQL table every night. One field is 'Address_3' and contains the City, State, Zip and Country fields. However, this data isn't standardized. How can I best parse the data that is currently going into 1 field into individual fields. Here are some examples of the data I might receive:
'INDIANAPOLIS, IN 46268 US'
'INDIANAPOLIS, IN 46268-1234 US'
'INDIANAPOLIS, IN 46268-1234'
'INDIANAPOLIS, IN 46268'
Thanks in advance!
David
I'm running windows xp and I've got MiniMagick and ImageMagick installed (latest versions). I'm now using the console to test out that everything works. Using the ms command prompt image magick works no problem. I'm testing this by using the identify command. Now, when I try to use MiniMagick from the console by entering
image = MiniMagick::Image.new('image.jpg')
It returns
MiniMagickError, "ImageMagick command ("identify \"input.jpg\"") failed: {:status_code = #"'identify' is not recognized as an internal or external command,\noperable program or batch file.\n"}
Can anybody help?
Not sure this is possible, but Looking to write a script that would return the average hex or rgb value for an image. I know it can be done in AS but looking to do it in JavaScript.
I tried to take input in form of string, specifically:
int i=0;
char c[50][500];
for(;i<50;++i)
scanf("%s",A[i]);
The input is
x is a website that allows the easy[1] creation and editing of any number of interlinked
web pages via a web browser using a simplified markup language or a WYSIWYG text editor.
In my program, I want the text to be stored as:
A[0]="x is a website that allows the easy[1] creation and editing of any number of interlinked"
A[1]=" web pages via a web browser using a simplified markup language or a WYSIWYG text editor."
But my code causes the text to be stored as
A[0]="is"
A[1]="a"
A[2]="website"
....
What am I doing wrong?
I've got a string that could be in one of two forms:
prefix=key=value (which could have any characters, including '=')
or
key=value
So I need to split it either on the first or second equals sign, based on a boolean that gets set elsewhere. I'm doing this:
if ($split_on_second) {
$parts = explode('=', $str, 3);
$key = $parts[0] . '=' . $parts[1];
$val = $parts[2];
} else {
$parts = explode('=', $str, 2);
$key = $parts[0];
$val = $parts[1];
}
Which should work, but feels inelegant. Got any better ideas in php? (I imagine there's a regex-ninja way to do it, but I'm not a regex-ninja.;-)
I am trying to set the Text property of a drop down list option like this:
<asp:ListItem Value="AB" Text='<%= Resources.Get("USA") %>'></asp:ListItem>
But it isn't working, instead the Text value is literally <%= Resources.Get("USA") %> and not the string "USA".
i.e. it is not being interpreted as code.
What is the problem?
If I have a string
"this is a string"
How can I shorten it so that I only have one space between the words rather than multiple? (The number of white spaces is random)
"this is a string"
Hi folks,
Real quick question - what's the cleanest way of editing the characters in a string in C#?
i.e. what is cleanest C# equivalent of c++:
std::string myString = "boom";
myString[0] = "d";
What's the cleanest way of editing the characters in a string in C#?
What's the C# equivalent of this in C++:
std::string myString = "boom";
myString[0] = "d";
I want to assign a xml code into a string variable.
I can do this without escaping single or double-quotes by using triple-quote in python.
Is there a similar way to do this in F# or C#?
Hello,
I am trying to set up a list of file names for a parameter to SHFileOperation. I want to be able to concatenate a file name onto the char array, but i dont want to get rid of the terminating character. for example, I want this:
C:\...\0E:\...\0F:\...\0\0
when i use strcat(), it overwrites the null, so it looks like
C:\...E:\...F:\...0\
Is there any easy way to do this? or am i going to have to code a new strcat for myself?
How do I find:
string str="(120)(1500)x";
How to find out in the event that the string contains:
string str1="()()X";
I then have to print:
console.writeline("str1 doesnt contain a numerical");
Hi Everyone:
I am wondering if there is some way to align text on the right of a photo, and keep the text in that same "box" even after the image ends using HTML and CSS. A quick "diagram" of what I am attempting to accomplish is below:
------- --------
------- --------
-Image- - Text -
------- --------
------- --------
--------
--------
Thanks for any help!
I'm implementing Bagwell's Ideal Hash Trie in Haskell. To find an element in a sub-trie, he says to do the following:
Finding the arc for a symbol s,
requires ?nding its corresponding bit
in the bit map and then counting the
one bits below it in the map to
compute an index into the ordered
sub-trie.
What is the best way to do this? It sounds like the most straightforward way of doing this is to select the bits below that bit and do a population count on the resulting number. Is there a faster or better way to do this?
I was wondering how to save PHP variables to a txt file and then
retrieve them again.
Example:
There is an input box, after submitted the stuff that was written in
the input box will be saved to a text file. Later on the results need
to be brought back as a variable. So lets say the variable is $text I
need that to be saved to a text file and be able to retrieve it back
again.
Hope it makes sense,
Thanks in advance!!!
I'm trying to implement a simple text animation in a custom UITableViewCell without having to go into editing mode which automatically brings up the delete button on the right. What I'm trying to accomplish is that when the label is updated by a button within the UITableviewcell, the text in the label is updated but with some smooth animation like sliding to the right since the updated text is prepended to the string. Any sample code would be great. thanks
Customer.text is a field in an T-SQL DB (that I do not control and thus may not alter) of type "text".
I'd like to do something like this:
List<string> compare = new List<string>();
compare.Add("one");
compare.Add("two");
var q = from t in customer
where t.text.Contains( compare.First())
select t;
this will work.
But now I'd like to do something like: (!NOT WORKING!)
var q = from t in customer
where compare.Contains( t.text )
select t;
How can I achieve this? Is it even possible?
Hi all.., I have number : 1, 2, 3, 4, 10
But I wanna print that number
0001
0002
0003
0004
0010
I have search in google, the keyword is number format. but I've got nothing, I just get, frmat decimal such ass 1,000,000.00. hope you can suggest me a reference or give me some problem solving.
Thanks,
I am passing in command line arguments to my Lisp program and they are formatted like this when they hit my main function:
("1 1 1" "dot" "2 2 2")
I have a dot function and would like to call it directly from the argument, but this isn't possible because something like (funcall (second args)...) receives "dot" and not dot as the function name.
I tried variations of this function:
(defun remove-quotes (s)
(setf (aref s 0) '""))
to no avail, before realizing that the quotes were not really a part of the string. Is there a simple way to do this, or should I just check each string and then call the appropriate function?
Thanks!
In java, Does the following line has a possiblity (even 0.01%) to throw a NullPointerException??
if (str1 == null)
Actually I am falling some bug in the code and It says that similar line throws a java.lang.NullPointerException ?!
I have a file which contains three integers per line. When I read the line I use a stringstream to separate the values, but it only reads the first value as it is. The other two are read as zero's.
ifstream inputstream(filename.c_str());
if( inputstream.is_open() ){
string line;
stringstream ss;
while( getline(inputstream, line) ){
//check line and extract elements
int id;
double income;
int members;
ss.clear();
ss.str(line);
ss >> id >> income >> members;
In the case above, id is extracted correctly, but income, and members get assigned zero instead of the actual value.
I'm reading an array of hard-coded strings of numeric characters - all positions are filled with a character, even for the leading zeros. Thus, can confidently parse it using substring(start, end) to convert to numeric.
Example: "0123 0456 0789"
However, a string coming from a database does not fill in the leading zero with a 'zero character', it simply fetches the '123 456 789', which is correct for an arithmetic number but not for my needs and makes for parsing trouble.
Before writing conditionals to check for leading zeros and adding them to the string if needed, is there a simple way of specifying they be filled with a character ? I'm not finding this in my Java book...
I could have done the three conditionals in the time it took to post this but, this is more about 'education'...
Thanks