concatenation

Why can I not concatenate two strings and assign them to a symbol?

. . . as in this example: helloworld.rb:1: syntax error, unexpected '=', expecting $end :helloworld = "hello ".concat("world") I thought if I use concat I'm modifying the string "hello " and adding "world" to it and then ultimately assigning the resulting string - "hello world" - to the :helloworld symbol on the left side of the equal...

Why does the absence of the assignment operator permit me to modify a Ruby constant with no compiler warning?

In the following two examples I do the same thing, creating a constant String and using the concat method to modify it. Because it's a constant, I expect a compiler warning but only receive one in the second example when I use the assignment operator. Why is this? X = "hello" X.concat(" world") puts X # no warning X = "hello" X = X.con...

How do I add a space between two concatenated NSStrings?

I have three string objects: NSString *firstName; NSString *lastName; NSString *fullName; The values for firstName and lastName are received from NSTextFields. I then want to concatenate the two strings and place the result in fullname. This is the code that I'm using: fullName = [firstName stringByAppendingString:lastName]; Howe...

Show a one to many relationship as 2 columns - 1 unique row (ID & comma separated list)

I need something similar to these 2 SO questions, but using Informix SQL syntax. http://stackoverflow.com/questions/37696/concatenate-several-fields-into-one-with-sql http://stackoverflow.com/questions/368459/sql-help-select-statement-concatenate-a-one-to-many-relationship My data coming in looks like this: id codes 63592 PE...

Concatenating strings

Hi all, I have a vector of string and I intend to join these strings into a single string, separated by a space. For example, if my vector contains the values: sample string for this example I want the output to be "sample string for this example". Need any of your input on what is the simplest way of achieving this? Thanks ...

Python: List concatenation. What is difference in "append" and "+= []"?

What is the difference in: some_list1 = [] some_list1.append("something") and some_list2 = [] some_list2 += ["something"] I hope this hasn't been already posted. If so just point me in that direction :) Thanks for your help. EDIT I've edited the title to reflect what I actually mean: "+ []" should have been "+= []". ...

Is there any difference between +-ing strings and <<-ing strings in c++?

What is the difference, if any between the effects of the following snippets: cout << "Some text" << s1 << "some more text\n"; cout << "Some text" + s1 + "some more text\n"; ...

PostgreSQL concatenation

I got this function to concat fields in my pgSQL-server: BEGIN IF acc IS NULL OR acc = '' THEN RETURN instr; ELSE RETURN acc || ';' || instr; END IF; END; It works great, but now I want this function to distinct equal entries. How can I do this? ...

T-SQL - Select records into concatenated text?

I'm trying to investigate when & why certain rows are getting deleted in a SQL 2005 database. I've started building a trigger to log some information when a row is deleted. My trigger is activated when row(s) are deleted from a certain table. I have it set up to log a timestamp in another logging table when the delete occurs. I'd also l...

Concatenating C++ iterator ranges into a const vector member variable at construction time

I have a class X, which I provide a snippet of here: class X { public: template <typename Iter> X(Iter begin, Iter end) : mVec(begin, end) {} private: vector<Y> const mVec; }; I now want to add a new concatenating constructor to this class, something like: template <typename Iter1, typename Iter2> X(Iter1 begin1, Ite...

Why does IO.Path.Combine only take 2 arguments?

I'm surprised there's not an overload that can take a string array. Anyway, what is the best way to avoid nesting calls to Path.Combine? pathValue = Path.Combine(path1, Path.Combine(path2, Path.Combine(path3, path4))) This seems inefficient since it results in 4 new strings being created just to get 1. ...

Why won't this PHP iteration work?

I want to make the results of a foreach loop into a string variable I can use later all over (so I don't need to paste the foreach loop everywhere). I have this: foreach($pairs as $d=>$m) { $orderedpairs .= "[".$d."],[".$m."]"+"<br />"; } echo $orderedpairs; If I substitute the assignment operator with "echo", it works fine, so the lo...

XSLT concat string, remove last comma

I need to build up a string using XSLT and separate each string with a comma but not include a comma after the last string. In my example below I will have a trailing comma if I have Distribution node and not a Note node for instance. I don't know of anyway to build up a string as a variable and then truncate the last character in XSLT. ...

Concatenate a selected column in a single query?

I know you can do this, because I've seen it done once before, but I forget where and up until now I haven't need to do it. I have a table called Employees, and it has various employee data (duh). I need a query that will do a select on the first and last name of all rows in the table, and then contenate all of them into a comma delimit...

concatenate two fields in a dropdown

in an sql table there's an id, first name and last name field. i'd like to concatenate the first and the last name fields and display it as one in a dropdown control. this is the vb.net code: con() sqry = "[SELECT QUERY]" sqcom = New SqlCommand(sqry, sqcon) da.SelectCommand = sqcom ds.Clear() da.Fill(ds) ddl_a...

What's an efficient way to concatenate all strings in an array, separating with a space?

Let's say I have an array of strings: string[] myStrings = new string[] { "First", "Second", "Third" }; I want to concatenate them so the output is: First Second Third I know I can concatenate them like this, but there'll be no space in between: string output = String.Concat(myStrings.ToArray()); I can obviously do this in a loo...

Concat Date As Text

I am attempting the following formula: =concatenate(A1, " ", B1, " - ", C1) Where column A is text, B and C are dates. The concatenate function returns the numerical value of the date, rather than the text value. How do I fix this? ...

Is it better practice to use String.format over string Concatenation in Java?

Is there a perceptable difference between using String.Format and string concatenation in Java? I tend to use String.format but occasionally will slip and use a concat, I was wondering if one was better than the other. The way I see it String.Format gives you more power in "formatting" the string and concatenation means you don't have ...

What would be the best way to use string functions and alteration on one string?

What should be the best way to write code: 1) Dim current = Request.Path current = current.Remove(0, 1) current = current.Replace(".aspx", "") 2) Dim current = Request.Path.Remove(0, 1).Replace(".aspx", "") 3) Dim current = Request.Path Dim current2 = current.Remove(0, 1) Dim current3 = current.Replace(".aspx", "") Or 1-2 mak...

concatenating strings in C

i was wondering if there was a way to add a value to a string, not like 1 + 1 = 2 but like 1 + 1 = 11. ...