string-concatenation

How to concatenate variable with string or variable in batch file

最后都变了- 提交于 2019-11-30 19:34:48
I would like to concatenate a variable with a string. In line 7 to line 11 I try to concat !somevariable! with a string or with %%P variable. But this does not seem to work. I.e. you have file 0_1_en.pdf in current folder. The script shortcuts the name of file to first digit. Afterwards I want to create a new variable with a string for example: "GEN 0" where 0 is the !sPDFName! Complete code: 1 SETLOCAL EnableDelayedExpansion 2 for /f "delims=" %%P in ('dir /b *.pdf') do ( 3 SET "sPDFName=%%~nxP" 4 echo "!sPDFName:~0,1!" 5 IF "!sPDFName:~0,1!"=="1" (SET "sPDFName=!sPDFName:~0,1!") 6 IF "

Include a variable inside a NSString?

怎甘沉沦 提交于 2019-11-30 17:40:47
问题 This works fine, we all know that: NSString *textoutput = @"Hello"; outLabel.text = textoutput; However, what if you want to include a variable inside that NSString statement like the following: NSString *textoutput =@"Hello" Variable; In C++ I know when I cout something and I wanted to include a variable all I did was soemthing like this: cout << "Hello" << variableName << endl; So I'm trying to accomplish that with Objective-C but I don't see how. 回答1: You can do some fancy formatting using

How to GROUP BY and CONCATENATE fields in redshift

若如初见. 提交于 2019-11-30 14:40:31
问题 How to GROUP BY and CONCATENATE fields in redshift e.g If i have table ID COMPANY_ID EMPLOYEE 1 1 Anna 2 1 Bill 3 2 Carol 4 2 Dave How can i get result like this COMPANY_ID EMPLOYEE 1 Anna, Bill 2 Carol, Dave There some solutions PostgreSQL, but none of functions mentioned in answers are available in Redshift righnow. 回答1: Well, I am a little late but the announcement about this feature happened on 3rd Aug 2015. Redshift has introduced LISTAGG window function that makes it possible to do so

How to GROUP BY and CONCATENATE fields in redshift

坚强是说给别人听的谎言 提交于 2019-11-30 11:16:04
How to GROUP BY and CONCATENATE fields in redshift e.g If i have table ID COMPANY_ID EMPLOYEE 1 1 Anna 2 1 Bill 3 2 Carol 4 2 Dave How can i get result like this COMPANY_ID EMPLOYEE 1 Anna, Bill 2 Carol, Dave There some solutions PostgreSQL , but none of functions mentioned in answers are available in Redshift righnow. Well, I am a little late but the announcement about this feature happened on 3rd Aug 2015. Redshift has introduced LISTAGG window function that makes it possible to do so now. Here is a quick solution to your problem - may or may not be useful but putting it here so that people

Concatenating strings with `if` statements in JavaScript

你离开我真会死。 提交于 2019-11-30 10:54:22
I'm attempting to set up a script to concatenate some variables inside a string if they exist , in order to place the appropriate metadata tags into a rendered HTML document. My concatenation code is: data = "<html>\n<head>\n" + "</head>\n<body>\n\n" + paras.join("\n\n") + "\n\n</body>\n</html>"; I'm trying to add if statements like the following into it (between the first and second items): if (typeof metadata_title !== "undefined") { "<title>" + metadata_title + "</title>\n" } if (typeof metadata_author !== "undefined") { "<meta name=\"author\" content=\"" + metadata_author + "\"></meta>\n"

Limit listagg function to first 4000 characters [duplicate]

99封情书 提交于 2019-11-30 10:22:50
This question already has an answer here: LISTAGG function: “result of string concatenation is too long” 12 answers Oracle - ORA-01489: result of string concatenation is too long [duplicate] 1 answer I have a query that uses the listagg function to get all rows as a comma delimited string to ultimately be shipped to a big text box. I'm getting the following exception: ORA-01489: result of string concatenation is too long I know the problem is that the query being run to aggregate the data is returning so many rows that the string concatenation that listagg is doing violates the 4000 char limit

String concatenation with Groovy

此生再无相见时 提交于 2019-11-30 10:14:11
问题 What is the best (idiomatic) way to concatenate Strings in Groovy? Option 1: calculateAccountNumber(bank, branch, checkDigit, account) { bank + branch + checkDigit + account } Option 2: calculateAccountNumber(bank, branch, checkDigit, account) { "$bank$branch$checkDigit$account" } I've founded an interesting point about this topic in the old Groovy website: Things you can do but better leave undone. As in Java, you can concatenate Strings with the "+" symbol. But Java only needs that one of

SQL: Concatenate column values in a single row into a string separated by comma

限于喜欢 提交于 2019-11-30 08:02:37
问题 Let's say I have a table like this in SQL Server: Id City Province Country 1 Vancouver British Columbia Canada 2 New York null null 3 null Adama null 4 null null France 5 Winnepeg Manitoba null 6 null Quebec Canada 7 Seattle null USA How can I get a query result so that the location is a concatenation of the City, Province, and Country separated by ", ", with nulls omitted. I'd like to ensure that there aren't any trailing comma, preceding commas, or empty strings. For example: Id Location 1

Batch string concatenation in Excel

孤者浪人 提交于 2019-11-30 07:03:38
问题 I have a couple hundred of cells in Excel I would like to concatenate into a single string. Is there a simpler method of doing this than going through them one by one manually in order to type them into CONCATENATE(A1, A2, ....) ? CONCATENATE(A1:A255) does not work. 回答1: *In a new tab, type A1 in cell A1, *Type A2 in Cell A2 *Use fill series to complete the values in column A *Type A1 in cell B1 Use this forumal in cell B2 =B1&","&A2 Copy the formula down. Copy and paste values to harvest the

MongoDB concatenate strings from two fields into a third field

老子叫甜甜 提交于 2019-11-30 06:55:56
问题 How do I concatenate values from two fields and put it into a third one, the values are strings. I've tried this: db.collection.update({"_id" : { $exists : true }}, {$set: {column_2:{$add:['$column_4', '$column_3']}}}, false, true) doesn't seem to work though, throws not ok for storage . I've also tried this: db.collection.update({"_id" : { $exists : true }}, {$set: {column_2:{$add:['a', 'b']}}}, false, true) but even this shows the same error not ok for storage . I want to concatenate only