string-concatenation

Getting unicode string from its code - C#

I know following is the way to use unicode in C# string unicodeString = "\u0D15"; In my situation, I will not get the character code (0D15) at compile time. I get this from a XML file at runtime. I wonder how do I convert this code to unicode string? I tried the following // will not compile as unrecognized escape sequence string uni...

update sql syntax - reset a field to itself with a concatenation - sql server 2005

I'm getting and error using this syntax: update table set field1 = (field1+' - '+field2) where field1 = 'somevalue' It's not too happy with doing this for me. I know that the '+' for concatenation works in my select statements, so that is the right syntax. There is something else at play here... and I tried removing the parenthesis ...

Slow string concatenation over large input

I've written an n-ary tree ADT which works fine. However, I need to store its serialization in a variable a calling class. eg. DomTree<String> a = Data.createTreeInstance("very_large_file.xml"); String x = a.toString(); I've written method which serves the purpose exactly how I need it, but on very large inputs it takes forever (2...

How to Concatenate String in Objective-C (iPhone) ?

Firstly, the platform is iPhone and label.text changes the label displayed. Consider this scenario: I've an array of integers. And I want to display it on the screen. Here's my take on it: -(IBAction) updateText: (id)sender { int a[2]; a[0]=1; a[1]=2; a[2]=3; for (int i=0; i<=10;i++) label.text = [NSString stringB...

Merge two JSON objects programmatically

I have two JSON objects here, generated through the Google Search API. The URL's of these objects can be found below. http://ajax.googleapis.com/ajax/services/search/web?v=1.0&amp;q=hello%20world&amp;rsz=large http://ajax.googleapis.com/ajax/services/search/web?v=1.0&amp;q=hello%20world&amp;rsz=large&amp;start=8 As you can see the firs...

What is the difference between VBScript's + and & operator?

On every site that talks about VBScript, the '&' operator is listed as the string concatenation operator. However, in some code that I have recently inherited, I see the '+' operator being used and I am not seeing any errors as a result of this. Is this an accepted alternative? ...

Ternary operator and string concatenation quirk?

Hi I just want to know why this code yields (at least for me) an incorrect result. Well, probably i'm in fault here $description = 'Paper: ' . ($paperType == 'bond') ? 'Bond' : 'Other'; I was guessing that if paperType equals 'Bond' then description is 'Paper: Bond' and if paperType is not equals to 'Bond' then description is 'Paper...

XPath to return string concatenation of qualifying child node values

Can anyone please suggest an XPath expression format that returns a string value containing the concatenated values of certain qualifying child nodes of an element, but ignoring others: <div> This text node should be returned. <em>And the value of this element.</em> And this. <p>But this paragraph element should be ignor...

SQLite Update Syntax?

I think is is simple, but I'm not getting it. I have a table with this data id , name , description 1 , apple , '' 2 , orange , '' I am trying to pass the following statement to update the row so the description column is 'desc of apple' and 'desc of orange' but it is not working. Update TestTable Set description = 'desc of ' + name...

Linq Aggregate complex types into a string.

I've seen the simple example of the .net Aggregate function working like so: string[] words = { "one", "two", "three" }; var res = words.Aggregate((current, next) => current + ", " + next); Console.WriteLine(res); How could the 'Aggregate' function be used if you wish to aggregate more complex types? For example: a class with 2 proper...

What string concatenation method to use for N number of iterations?

Hi! If I want to concatenate a string N number of times, which method should i prefer? Take this code as an example: public static string Repeat(this string instance, int times) { var result = string.Empty; for (int i = 0; i < times; i++) result += instance; return result; } This method may be i...

Simple String and variable problem using jQuery

I'm trying to add my var to this string: var liPad = 20; $(this).css({'width' : width , 'height' : height, 'padding' : "'0px' + liPad + 'px'"}); To make it work like this: $(this).css({'width' : width , 'height' : height, 'padding' : '0 20px'}); Can't figure out how to make it work. Any help would be appreciated. ...

Easy way to concatenate list of strings into a comma-separated strings, where strings are members of an object?

Say I have a List(Of Tag) with Tag being an object. One member of Tag, Tag.Description, is a string, and I want to make a comma-separated concatenation of the Description members. Is there an easier way to do this than to read the Description members into a List(Of String) and then use the Join function? Thanks! ...

Android - String concatenate - how to keep the spaces at the end and/or beginning of String ?

I have to concatenate these two strings from my resource/value files: <string name="Toast_Memory_GameWon_part1">you found ALL PAIRS ! on </string> <string name="Toast_Memory_GameWon_part2"> flips !</string> I do it this way : String message_all_pairs_found = getString(R.string.Toast_Memory_GameWon_part1)+total_flips+getString(R.strin...

Why does this map return a single number?

Hello! I am trying to cut down on the number of code lines I am using but am ending up with a fairly simple problem (although it's stumping me since I am just starting to wrap my head around references) I am trying to concatenate several values in a particular order.. My code looks like this.. my $separator = ":"; my @vals = qw(name la...

Merge JavaScript objects

I've read another similiar question on SO but there wasn't a clear answer at that question. I got some JavaScript objects that look like this: var moveJSON = { 'name' : move[0].innerHTML, 'info' : move[1].innerHTML, 'power' : move[2].innerHTML, 'accuracy' : move[3].innerHTML, 'type' : move[4].innerHTML, 'cat...

How to efficiently concatenate strings in Go?

In Go, string is a primitive type, it's readonly, every manipulation to it will create a new string. So, if I want to concatenate strings many times without knowing the length of the resulting string, what's the best way to do it? The naive way would be: s := ""; for i := 0; i < 1000; i++ { s += getShortStringFromSomewhere(); } r...

C# Compile-Time Concatenation For String Constants

Does C# do any compile-time optimization for constant string concatenation? If so, how must my code by written to take advantage of this? Example: How do these compare at run time? Console.WriteLine("ABC" + "DEF"); const string s1 = "ABC"; Console.WriteLine(s1 + "DEF"); const string s1 = "ABC"; const string s2 = s1 + "DEF"; Console....

How do I concatenate a string in a PHP Array Element?

I am customizing wordpress blog and I have a need to make custom sidebar widgets. My PHP is rusty at best. What I am trying to do is concatenate a php variable into a string being set as an array element. here is the code I am using, it doesn't seem to work. All it does is print the stylesheet directory at the top of every page: if ...

Combine several variables of different data types into one string

I'd like to combine 6 variables that are of different types in my view...I thought the concatenation '+' will work but I get an error when I use it. I'd like the end result to be like this: var1 var2 var3 var4 (var5 var6) How do I go about this? ...