concatenation

How to concisely concatenate strings in Tcl?

荒凉一梦 提交于 2019-12-03 16:16:29
问题 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 some way to create result without introducing the temporary variables foo and bar? Doing this is incorrect for my purposes: concat [myFoo $arg] [myBar $arg] as it

SQL Server 2008 Rows to 1 CSV field

自作多情 提交于 2019-12-03 16:10:51
We're on SQL Server 2008 and I'm trying to figure out if there's a way to have a stored procedure return my results in 1 CSV field for example: SELECT TOP 4 carModels FROM dbo.Models would return Jeep Honda Mitsubishi Ford I would like this returned in 1 field like so: Jeep,Honda,Mitsubishi,Ford I know we can do this with an assembly, temp tables, or server side code but would prefer not to go that route. Are there any tips / tricks you could suggest to get the result I'm looking for? try this: DECLARE @x varchar(8000) SELECT TOP 4 @x=ISNULL(@x+', ','')+carModels FROM dbo.Models SELECT @x AS

Concatenate XML without type casting to string

佐手、 提交于 2019-12-03 15:50:08
问题 I have the following XML generated from various tables in my SQL SERVER database <XMLData> ... <Type>1</Type> ... </XMLData> AND <XMLData> ... <Type>2</Type> ... </XMLData> AND <XMLData> ... <Type>3</Type> ... </XMLData> The final output I need is single combined as follows: <AllMyData> <XMLData> ... <Type>1</Type> ... </XMLData> <XMLData> ... <Type>2</Type> ... </XMLData> <XMLData> ... <Type>3</Type> ... </XMLData> <AllMyData> NOTE - all the independent elements that I am combining have the

Concatenate files with npm as build tool

杀马特。学长 韩版系。学妹 提交于 2019-12-03 15:39:06
问题 I recently discovered that I can use npm as a task runner instead of gulp or grunt, everything is fantastic so far (lint, stylus, jade, uglify, watch .. etc) but the concatenation part, I cannot seem to achieve that. With gulp it was something like: gulp.task('scripts', function() { return gulp.src('www/js/**/*.js') .pipe(concat('all.js')) .pipe(gulp.dest('www/dist')) .pipe(rename('all.min.js')) .pipe(uglify()) .pipe(gulp.dest('www/dist')); }); Is there a way I can do that with npm? To be

Concatenate two Func delegates

核能气质少年 提交于 2019-12-03 15:14:58
问题 Assume that I have thes Class: public class Order { int OrderId {get; set;} string CustomerName {get; set;} } I declare below variables, too Func<Order, bool> predicate1 = t=>t.OrderId == 5 ; Func<Order, bool> predicate2 = t=>t.CustomerName == "Ali"; Is there any way that concatenate these variables(with AND/OR) and put the result in 3rd variable? for example: Func<Order, bool> predicate3 = predicate1 and predicate2; or Func<Order, bool> predicate3 = predicate1 or predicate2; 回答1: And: Func

Understanding the syntax of numpy.r_() concatenation

不羁的心 提交于 2019-12-03 11:35:54
问题 I read the following in the numpy documentation for the function r_: A string integer specifies which axis to stack multiple comma separated arrays along. A string of two comma-separated integers allows indication of the minimum number of dimensions to force each entry into as the second integer (the axis to concatenate along is still the first integer). and they give this example: >>> np.r_['0,2', [1,2,3], [4,5,6]] # concatenate along first axis, dim>=2 array([[1, 2, 3], [4, 5, 6]]) I don't

Concatenate JSONArrays

元气小坏坏 提交于 2019-12-03 10:52:14
问题 I am using JSONArray under the org.json Package. My first JSONArray is like: [["249404","VPR249404"],["249403","VPR249403"],["249391","M249391"]] and Second [["249386","M249386"],["249385","M249385(I)"],["249384","I249384"]] So I'd like to append new JSONArray to my first JSONArray. I am working on Java and Android. I have heard about google-gson library, but I don't know whether it can help me or not but I don't want any other dependency in my Android Application. 回答1: I would try something

Built-in string formatting vs string concatenation as logging parameter

霸气de小男生 提交于 2019-12-03 10:19:39
I'm using SonarLint that shows me an issue in the following line. LOGGER.debug("Comparing objects: " + object1 + " and " + object2); Side-note: The method that contains this line might get called quite often. The description for this issue is "Preconditions" and logging arguments should not require evaluation (squid:S2629) Passing message arguments that require further evaluation into a Guava com.google.common.base.Preconditions check can result in a performance penalty. That's because whether or not they're needed, each argument must be resolved before the method is actually called. Similarly

String.Concat inefficient code?

南楼画角 提交于 2019-12-03 09:35:38
I was investigating String.Concat : (Reflector) very strange : the have the values array , they creating a NEW ARRAY for which later they send him to ConcatArray . Question : Why they created a new array ? they had values from the first place... edit code : public static string Concat(params string[] values) { if (values == null) { throw new ArgumentNullException("values"); } int totalLength = 0; string[] strArray = new string[values.Length]; for (int i = 0; i < values.Length; i++) { string str = values[i]; strArray[i] = (str == null) ? Empty : str; totalLength += strArray[i].Length; if

How can I concatenate set of results in MySQL?

你离开我真会死。 提交于 2019-12-03 09:25:28
I would like to join results returned in the set in MySQL with a comma as a separator string. For example, set returned contains: COLUMN_X john jerry maria joseph gugla I would like to receive the result as: COLUMN_X-concat john,jerry,maria,joseph,gugla is that possible? thanks. SELECT CONCAT(rooms.ID,",") FROM rooms AS rooms LEFT JOIN inter AS i ON rooms.ID=i.value WHERE xxx=999 doesn't work as I would like it to as it returns separate results. SELECT GROUP_CONCAT(COLUMN_X SEPARATOR ',') FROM <<table>> GROUP BY NULL See GROUP_CONCAT . 来源: https://stackoverflow.com/questions/1728417/how-can-i