string-concatenation

Limit listagg function to first 4000 characters [duplicate]

和自甴很熟 提交于 2019-12-08 23:39:17
问题 This question already has answers 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) Closed 4 years ago . 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

paste grid — expand.grid for string concatenation

若如初见. 提交于 2019-12-08 15:44:58
问题 If we want to get all combinations of two vectors, we can use rep /recycling rules: x <- 1:4 y <- 1:2 cbind(rep(x, each = length(y)), rep(y, length(x))) # [,1] [,2] # [1,] 1 1 # [2,] 1 2 # [3,] 2 1 # [4,] 2 2 # [5,] 3 1 # [6,] 3 2 # [7,] 4 1 # [8,] 4 2 But expand.grid is much nicer -- it handles all the repetition for us. expand.grid(x, y) # Var1 Var2 # 1 1 1 # 2 2 1 # 3 3 1 # 4 4 1 # 5 1 2 # 6 2 2 # 7 3 2 # 8 4 2 Is there a simple version of this for concatenating strings? Like paste.grid ?

Is += more efficient than concat? [duplicate]

时间秒杀一切 提交于 2019-12-08 15:04:27
问题 This question already has answers here : String concatenation: concat() vs “+” operator (11 answers) Closed 5 years ago . I've been reading code produced by other developers on my team, they seem to favor using += for String concatenation, whereas I prefer using .concat() as it feels easier to read. I'm trying to prepare an argument as to why using .concat() is better, and I'm wondering, is there any difference in efficiency between the two? Which option "should" we be taking? public class

Is String concatenation on assignment efficient?

℡╲_俬逩灬. 提交于 2019-12-07 23:49:15
问题 I know that using the "+" concatenation operator for building strings is very inefficient, and that is why it is recommended to use the StringBuilder class, but I was wondering if this kind of pattern is inefficient too? String some = a + "\t" + b + "\t" + c + "\t" + d + "\t" + e; I guess here the compiler will optimize the assignment fine, or not? 回答1: This particular example will be inlined by the compiler: String a = "a"; String b = "bb"; String c = "ccc"; String some = a + "\t" + b + "\t"

String concatenation doesn't work for comma character

徘徊边缘 提交于 2019-12-07 19:04:40
问题 String concatenation on bash script doesn't work on comma "," character. A="Hello"; B=",World"; C=$A$B echo $C; It prints the output as Hello World Bash version is: GNU bash, version 4.1.2(1)-release (x86_64-redhat-linux-gnu) The same code seems to work in here 回答1: The most likely explanation is that you have $IFS set to , The simplest way around this is to double-quote $C , in which case echo is passed the value unmodified : echo "$C" Also note that you don't need the semicolons to

Merge JavaScript objects

烈酒焚心 提交于 2019-12-07 15:26:15
问题 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, 'category' : move[5].innerHTML, 'pp_min' : move[6].innerHTML, 'pp_max' : move[7].innerHTML } I need to merge them into one object, that will be send to PHP via AJAX. But first: what's the best

What happens if you remove the space between the + and ++ operators?

巧了我就是萌 提交于 2019-12-07 01:40:24
问题 EDIT 1 DISCLAIMER: I know that +++ is not really an operator but the + and ++ operators without a space. I also know that there's no reason to use this; this question is just out of curiosity. So, I'm interested to see if the space between + and ++var is required in Java. Here is my test code: int i = 0; System.out.println(i); i = i +++i; System.out.println(i); This prints out: 0 1 which works as I would expect, just as if there were a space between the first and second + . Then, I tried it

How to concatenate static strings at compile time?

丶灬走出姿态 提交于 2019-12-06 22:27:51
问题 I am trying to use templates to create an analogue of the type_info::name() function which emits the const -qualified name. E.g. typeid(bool const).name() is "bool" but I want to see "bool const" . So for generic types I define: template<class T> struct type_name { static char const *const _; }; template<class T> char const *const type_name<T>::_ = "type unknown"; char const *const type_name<bool>::_ = "bool"; char const *const type_name<int>::_ = "int"; //etc. Then type_name<bool>::_ is

ruby - simplify string multiply concatenation

◇◆丶佛笑我妖孽 提交于 2019-12-06 21:50:41
问题 s is a string, This seems very long-winded - how can i simplify this? : if x === 2 z = s elsif x === 3 z = s+s elsif x === 4 z = s+s+s elsif x === 5 z = s+s+s+s elsif x === 6 z = s+s+s+s+s Thanks 回答1: Something like this is the simplest and works (as seen on ideone.com): puts 'Hello' * 3 # HelloHelloHello s = 'Go' x = 4 z = s * (x - 1) puts z # GoGoGo API links ruby-doc.org - String: str * integer => new_str Copy—Returns a new String containing integer copies of the receiver. "Ho! " * 3 #=>

stringByAppendingFormat not working

好久不见. 提交于 2019-12-06 19:01:17
问题 I have an NSString and fail to apply the following statement: NSString *myString = @"some text"; [myString stringByAppendingFormat:@"some text = %d", 3]; no log or error, the string just doesn't get changed. I already tried with NSString (as documented) and NSMutableString. any clues most welcome. 回答1: I would suggest correcting to (documentation): NSString *myString = @"some text"; myString = [myString stringByAppendingFormat:@" = %d", 3]; From the docs: Returns a string made by appending to