concatenation

XDocument/Linq concatenate attribute values as comma separated list.

If I have the following xml: XDocument xDocument = new XDocument( new XElement("RootElement", new XElement("ChildElement", new XAttribute("Attribute1", "Hello"), new XAttribute("Attribute2", "World") ), new XElement("ChildElement"...

How to programmaticly concatenate with ANT?

Let me preface by saying that I'm new to ant, and I'm using version 1.6.5 if it matters. I have a file with a list of files that I want to concatenate. The relevant part of my first attempt was this: <target name="for-each"> <xmlproperty file="scripts.xml" collapseAttributes="true" /> <echo message="testing for-each"/> <con...

How to expand JavaScript Array with another Array?

There doesn't seem to be a way to expand a JavaScript Array with another Array, i.e. to emulate Python's extend method. What I want to achieve is the following: >>> a = [1, 2] [1, 2] >>> b = [3, 4, 5] [3, 4, 5] >>> SOMETHING HERE >>> a [1, 2, 3, 4, 5] I know there's a a.concat(b) method, but it creates a new array instead of simply e...

Concatenating strings in C, which method is more efficient?

Hi, I came across these two methods to concatenate strings: Common part: char* first= "First"; char* second = "Second"; char* both = malloc(strlen(first) + strlen(second) + 2); Method 1: strcpy(both, first); strcat(both, " "); strcat(both, second); Method 2: sprintf("%s %s", first, second); In both cases the content of both wou...

Concatenation of strings in Lua

In many languages you can concatenate strings on variable assignment. I have a scenario, using the Lua programming language, where I need to append the output of a command to an existing variable. Is there a functional equivalent in Lua to the below examples? Examples of other languages: ===== PERL ===== $filename = "checkbook"; $fil...

Concatenation of tables in Lua

ORIGINAL POST Given that there is no built in function in Lua, I am in search of a function that allows me to append tables together. I have googled quite a bit and have tried every solutions I stumbled across but none seem to work properly. The scenario goes like this: I am using Lua embeded in an application. An internal command of...

Add a break line between concatenated strings in VB.net

Guys, I am trying to concatenate the output of various functions into a textbox, but it all comes up in one biiig line. How can I insert break lines in between the variables? I have something like this: Me.TextBox.text = output1 + output2 And I would like to have something like this: Me.TextBox.text = output1 + ENTER + output2 Any...

How to concatenate vars in c programmed pic?

Hi guys, I programming a 16f84a pic in hitech C to drive a hd44780 lcd. So far I've got the lcd initialized and can write individual characters and strings to the lcd. Now I need to do something like this: var = 250; lcd_write_string("MyVar has value: " + var); so the lcd should show "MyVar has value: 250" First of all how should I con...

mysql concatenating extract results with string

Current Code: WHERE EXTRACT(YEAR_MONTH FROM timestamp_field) = EXTRACT(YEAR_MONTH FROM now())") Instead of EXTRACT(YEAR_MONTH FROM now()), I want EXTRACT(YEAR FROM now()), but I want to hard code the month in. How do I go about concatenating the extract results with the MM month, for example 09. I tried a few options below, with no l...

Need to concatenate varying number of cells using Macro

I need to concatenate a column of cells based on a variable in a previous cell. This will continue on until the specified variable changes. For example: A B C D E 1 x @1 @1+@2+@3 2 x @2 3 x @3 4 y %1 %1+%2+%3 5 y %2 6 y %3 etc. I need the macro to look at A1 and if it's x then begin a concatenated string ...

How to concisely concatenate strings in Tcl?

I can easily concatenate two variables, foo and bar, as follows in Tcl: "${foo}${bar}". However, if I don't want to put an intermediate result into a variable, how can I easily concatenate the results of calling some proc? Long hand this would be written: set foo [myFoo $arg] set bar [myBar $arg] set result "${foo}${bar}" Is there s...

C preprocessor and concatenation

I am trying to write a code, where name of functions are dependent on the value of a certain macro variable. To be specific, I am trying to write a macro like this: #define VARIABLE 3 #define NAME(fun) fun ## _ ## VARIABLE int NAME(some_function)(int a); Unfortunately, the macro NAME() turns that into int some_function_VARIABLE(int ...

PHP string concatination using ","?

I just discovered something. If I type this: echo $var1 , " and " , $var2; it is the same as: echo $var1 . " and " . $var2; What is the actual of concatenation operator in php? Using . or ,? ...

MS Access 2003 - Concatenating Field Types of Same ID on a Form

Ok so a guy at work has a little access database he uses to keep track of things. He has this form that he uses that already queries what he needs and produces the results on a form and that is really all he needs. One thing is that he has duplicates for every record that comes up with a different "Type" as a field "indentifier" (what I...

jQuery passing element ID into jquery statement?

I'd like to pass the ID of an element into a function which then calls jQuery. However, I'm stumped as to how to actually take the ID variable and concatenate it with other text inside the jQuery statement. For example, this returns an error: myFunction("#myObject"); function myFunction(IDofObject){ $("'"+IDofObject+" img'").doSom...

jQuery concatenate question...

Ok. html: <div class="selector"> <select name="something"> //this is what myVar is referring to. <option>stuff</option> </select> </div> Say I have var: var myVar = $(".selector").find("[name=something]"); And I want to concatenate with option:selected: $(myVar here + " option:selected").change(function(){ //d...

Concatenating a list of numbers into one integer in haskell

Hi I am doing yet another euler project question (38). I have this function which returns a list of numbers but what I need is that list of numbers to be one number. It calculates the concatenated product of an integer. f (a,b) = a*b conProInt x n = map f (zip (replicate n x) ([1..n])) prob38 = maximum [ (conProInt (x) (n)) | x <- [1...

concatenate with jquery

Hi, I tried to concatenate a string to a div with its value but I can't please help. Here is my little codes var server = 'server name: ' $('#div').load('myservername.aspx'); I like to display at div id is server name: myserver Thanks. ...

StringBuilder vs String concatenation in toString() in Java

Given the 2 toString() implementations below, which is prefered public String toString(){ return "{a:"+ a + ", b:" + b + ", c: " + c +"}"; } or public String toString(){ StringBuilder sb = new StringBuilder(100); return sb.append("{a:").append(a) .append(", b:").append(b) .append(", c:").append(c) ...

String concatenation is extremly slow when input is large

Things like the code below is super slow: var str:String = "" for (var i:Number = 0 ; i<1000000000000000000 ; ++i) { str += "someLongLongLongLongLongLongLongLongLongString"; } There is StringBuilder in Java but seems there is no equivalent for AS. So, how do you guys handle large strings concatenation? Update: Thanks for every...