concatenation

Add a break line between concatenated strings in VB.net

…衆ロ難τιáo~ 提交于 2019-12-10 14:29:05
问题 I am trying to concatenate the output of various functions into a textbox, but it all comes up in one biiig line. How can I insert break lines in between the variables? I have something like this: Me.TextBox.text = output1 + output2 And I would like to have something like this: Me.TextBox.text = output1 + ENTER + output2 Any ideas? Thanks! 回答1: The Environment.NewLine read-only variable is what you want to use. There's also vbCrLf , but this is for legacy purposes and not environment

How to concatenate strings with C preprocessor with dots in them?

烂漫一生 提交于 2019-12-10 13:51:19
问题 I've read the following question and the answer seems clear enough: How to concatenate twice with the C preprocessor and expand a macro as in "arg ## _ ## MACRO"? But what if VARIABLE has a dot at the end? I'm trying to do a simple macro that increments counters in a struct for debugging purposes. I can easily do this even without the help from the above question simply with #ifdef DEBUG #define DEBUG_INC_COUNTER(x) x++ #endif and call it DEBUG_INC_COUNT(debugObj.var1); But adding "debugObj."

Why does “SELECT DISTINCT a, b FROM…” return fewer records than “SELECT DISTINCT A + '|' + B FROM…”?

廉价感情. 提交于 2019-12-10 12:59:32
问题 I have a query that's selecting a bunch of fields related to names and addresses of customers but it boils down to: SELECT DISTINCT a, b, c, ... FROM big_dumb_flat_table it returns a bunch of records (10986590). When I replace the commas in the select-list to format it as a pipe-separated concatenated string: SELECT DISTINCT a + '|' + b + '|' + c + '|' + ... FROM big_dumb_flat_table it's returning 248 more records. I've reassured myself that there are no pipes in any of the fields that could

Is it better to use ob_get_contents() or $text .= 'test';

此生再无相见时 提交于 2019-12-10 12:43:36
问题 I have seen a lot of ob_get_clean() the last while. Typically I have done $test .= 'test' I'm wondering if one is faster and/or better than the other. Here is the code using ob_get_clean() : ob_start(); foreach($items as $item) { echo '<div>' . $item . '</div>'; } $test = ob_get_clean(); Here is the code using $test .= 'test' : $test = ''; foreach($items as $item) { $test .= '<div>' . $item . '</div>'; } Which is better? 回答1: Output buffers have all the pitfalls of global variables. You have

Does string concatenation use StringBuilder internally?

£可爱£侵袭症+ 提交于 2019-12-10 12:33:51
问题 Three of my coworkers just told me that there's no reason to use a StringBuilder in place of concatenation using the + operator. In other words, this is fine to do with a bunch of strings: myString1 + myString2 + myString3 + myString4 + mySt... The rationale that they used was that since .NET 2, the C# compiler will build the same IL if you use the + operator as if you used a StringBuilder. This is news to me. Are they correct? 回答1: No, they are not correct. String concatenation creates a new

MYSQL - append or insert value into a column depending on whether it's empty or not

邮差的信 提交于 2019-12-10 12:04:11
问题 As title says, im trying to append a string to a VARCHAR column in my table. The string is something like " //string ", forward slashes will be used later to explode the string to an array in PHP. I was wondering if there's a way in MYSQL to perform a CONCAT(columnname, "//string") if the column is empty, otherwise perform a normal UPDATE ... SET ... WHERE . In this way, i will avoid the first value of my future exploded string to be a "//string" with forward slahes. also, above I 've used

Concatenate pandas dataframe with result of apply(lambda) where lambda returns another dataframe

 ̄綄美尐妖づ 提交于 2019-12-10 11:42:24
问题 A dataframe stores some values in columns, passing those values to a function I get another dataframe. I'd like to concatenate the returned dataframe's columns to the original dataframe. I tried to do something like i = pd.concat([i, i[['cid', 'id']].apply(lambda x: xy(*x), axis=1)], axis=1) but it did not work with error: ValueError: cannot copy sequence with size 2 to array axis with dimension 1 So I did like this: def xy(x, y): return pd.DataFrame({'x': [x*2], 'y': [y*2]}) df1 = pd

concatenation in javascript?

元气小坏坏 提交于 2019-12-10 11:41:35
问题 i want to concatenate two string in javascript i.e. $('#bio').css('font-color', result.titlecolor); but i want to put the character # before the result.titlecolor i.e. $('#bio').css('font-color','#' result.titlecolor); is this right or wrong? thanks 回答1: $('#bio').css('color','#' + result.titlecolor); (Edited to reflect @BoltClock's comment about 'color' versus 'font-color'.) 回答2: This: '#' result.titlecolor needs to be: '#'+ result.titlecolor In javascript the + operator concatenates to

concatenate a column on one line depends on a id

霸气de小男生 提交于 2019-12-10 11:25:34
问题 I've again a basic question : If I do : SELECT DISTINCT id, date, doctext, docline, from documentation where date in (02/14/2017) doctext is a char(80) and I cannot change it. The problem of this columns is the size, I cannot save a value > 80 characters, If the doc is > 80 char, it will save two lines in SQL and upgrade the docline So my result is, for example : 0 2017-02-14 this is a basic test to show you the result 0 1 2017-02-14 this is a new basic test to show you the result 0 2 2017-02

How can I concatenate float with string?

一世执手 提交于 2019-12-10 11:08:09
问题 I tried this: ostringstream myString; float x; string s; if(x) myString<<x; else myString<<s; return myString.str(); But it doesn't work. My goal is to concatenate into myString, a float and a string, with a space between them, before testing if one of them is NULL. 回答1: Why the else inbetween? Try this: ostringstream myString; float x; string s; if (fabsf(x) > 1e-30){ myString<<x << " "; } if(s.length() > 0) myString<<s; return myString.str(); //does ostringstream has a str()-member? 回答2: