Include constant in string without concatenating
Is there a way in PHP to include a constant in a string without concatenating? define(‘MY_CONSTANT’, 42); echo “This is my constant: MY_CONSTANT”; 14 Answers 14
Is there a way in PHP to include a constant in a string without concatenating? define(‘MY_CONSTANT’, 42); echo “This is my constant: MY_CONSTANT”; 14 Answers 14
I have two string columns a and b in a table foo. select a, b from foo returns values a and b. However, concatenation of a and b does not work. I tried : select a || b from foo and select a||’, ‘||b from foo Update from comments: both columns are type character(2). 8 … Read more
If I have: List<string> myList1; List<string> myList2; myList1 = getMeAList(); // Checked myList1, it contains 4 strings myList2 = getMeAnotherList(); // Checked myList2, it contains 6 strings myList1.Concat(myList2); // Checked mylist1, it contains 4 strings… why? I ran code similar to this in Visual Studio 2008 and set break points after each execution. After myList1 … Read more
I have a list of 20 file names, like [‘file1.txt’, ‘file2.txt’, …]. I want to write a Python script to concatenate these files into a new file. I could open each file by f = open(…), read line by line by calling f.readline(), and write each line into that new file. It doesn’t seem very … Read more
I haven’t seen anything here or on MDN. I’m sure I’m just missing something. There’s got to be some documentation on this somewhere? Functionally, it looks like it allows you to nest a variable inside a string without doing concatenation using the + operator. I’m looking for documentation on this feature. Example: var string = … Read more
I have two instances of IEnumerable<T> (with the same T). I want a new instance of IEnumerable<T> which is the concatenation of both. Is there a built-in method in .NET to do that or do I have to write it myself? 5 Answers 5
I am wondering, What is the proper way for inserting PHP variables into a string? This way: echo “Welcome “.$name.”!” Or this way: echo “Welcome $name!” Both of these methods work in my PHP v5.3.5. The latter is shorter and simpler but I’m not sure if the first is better formatting or accepted as more … Read more
What is the easy way to concatenate two byte arrays? Say, byte a[]; byte b[]; How do I concatenate two byte arrays and store it in another byte array? 13 Answers 13
Is there a perceptible difference between using String.format and String concatenation in Java? I tend to use String.format but occasionally will slip and use a concatenation. 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 … Read more
This question already has answers here: How do I merge two dictionaries in a single expression (take union of dictionaries)? (48 answers) Closed 8 years ago. Say I have three dicts d1={1:2,3:4} d2={5:6,7:9} d3={10:8,13:22} How do I create a new d4 that combines these three dictionaries? i.e.: d4={1:2,3:4,5:6,7:9,10:8,13:22} 5 Answers 5