string-concatenation Questions

7

Solved

As a result of the comments in my answer on this thread, I wanted to know what the speed difference is between the += operator and ''.join() So what is the speed comparison between the two?
Protestation asked 16/6, 2010 at 16:58

4

Strings in Python are immutable, which means the value cannot be changed. However, when appending to the string in the following example, it looks like the original string memory is modified since ...

8

Solved

How do I concatenate values from two string fields and put it into a third one? I've tried this: db.collection.update( { "_id": { $exists: true } }, { $set: { column_2: { $add: ['$column_4', '$...

5

Solved

I see the benefit of using interpolated strings, in terms of readability: string myString = $"Hello { person.FirstName } { person.LastName }!" over a concatenation done this way: string myStrin...
Trapezium asked 21/2, 2017 at 14:51

6

Solved

What is the string concatenation operator in Oracle SQL? Are there any "interesting" features I should be careful of? (This seems obvious, but I couldn't find a previous question asking it).
Craniometer asked 10/11, 2008 at 15:42

1

Solved

Once I recklessly tried to optimize Class.resolveName() relying on the results of benchmark (available in the referenced PR) replicating the logic of the mentioned method. The idea of optimization ...
Wagonette asked 11/4, 2022 at 20:42

8

Solved

I'm finding a way to aggregate strings from different rows into a single row. I'm looking to do this in many different places, so having a function to facilitate this would be nice. I've tried solu...
Strauss asked 30/11, 2012 at 4:57

2

Solved

I use curl to test an user account creation API as follows: curl -s -X POST "https://$APISERVER/users" \ -H 'Content-Type: application/json' \ -d '{ \ "username": "'$NEWUSERNAME'", \ "firstName": ...
Noway asked 30/5, 2018 at 20:39

6

Solved

I see some people create a for loop and run through the slice as to create a string, is there an easier way to convert a []string to a string? Will sprintf do it?
Hoarding asked 20/1, 2017 at 5:0

6

Solved

I have an object which holds many values, and some of them (not all values from the object) need to be put in a CSV string. My approach was this: string csvString = o.number + "," + o.id ...
Enyedy asked 3/2, 2011 at 9:0

1

Solved

fn main() { let mut str = "string".to_string(); // How do I push String to String? str.push_str(format!("{}", "new_string")); } So, how do I push the formatted st...
Aliciaalick asked 18/1, 2022 at 10:54

22

Solved

Suppose I have the following snippet: $assoc = New-Object PSObject -Property @{ Id = 42 Name = "Slim Shady" Owner = "Eminem" } Write-Host $assoc.Id + " - " + $asso...
Unrestraint asked 27/2, 2013 at 13:34

2

Solved

In Java 9 Oracle improved String concatenation. Now "" + someBoolean turns into invokedynamic with StringConcatFabric.makeConcat as bootstrap method. That fabric generates classes at runtime that c...
Liveryman asked 3/11, 2019 at 14:45

4

Solved

There is a list which I would like to output into an excel file as a single string. I start with a list of characters. url="http://eutils.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi?db=pubmed&...
Cordage asked 16/2, 2012 at 15:46

21

Solved

How to concatenate string in Swift? In Objective-C we do like NSString *string = @"Swift"; NSString *resultStr = [string stringByAppendingString:@" is a new Programming Language"]; or NSString...
Pudendas asked 4/6, 2014 at 9:49

7

Solved

As you may know, in JavaScript '' + null = "null" and '' + undefined = "undefined" (in most browsers I can test: Firefox, Chrome and IE). I would like to know the origin of this oddity (what the he...
Geotaxis asked 13/12, 2013 at 17:3

10

Solved

Are there differences between these examples? Which should I use in which case? var str1 = "abc" + dynamicString + dynamicString2; var str2 = String.Format("abc{0}{1}", dynamicString, dynamicStri...
Volution asked 23/6, 2010 at 14:59

9

Solved

In Python say you have s = "string" i = 0 print s + i will give you error, so you write print s + str(i) to not get error. I think this is quite a clumsy way to handle int and string co...
Athenaathenaeum asked 19/7, 2012 at 10:41

22

I have the following values: int a=1; int b=0; int c=2; int d=2; int e=1; How do i concatenate these values so that i end up with a String that is 10221; please note that multiplying a by 10000...
Frizzly asked 20/4, 2010 at 11:42

3

Solved

I'm a novice in Excel macros so i'm looking out for some assistance to create a macro which would allow me to concatenate the values in the columns of an excel sheet containing details in the follo...
Unnamed asked 30/7, 2021 at 14:12

4

Solved

In Javascript, hello += ' world' // is shorthand for hello = hello + ' world' Is there a shorthand operator for the opposite direction? hello = ' world' + hello I tried hello =+ ' world' but ...
Fortunna asked 18/2, 2016 at 19:14

3

Solved

In python pandas, there is a Series/dataframe column of str values to combine into one long string: df = pd.DataFrame({'text' : pd.Series(['Hello', 'world', '!'], index=['a', 'b', 'c'])}) Goal: ...
Esparza asked 30/12, 2016 at 17:43

9

Solved

I'm using a foreach loop to echo out some values from my database and separating each of them by commas. I don't know how to remove the last comma it adds on the last value. My code is pretty simpl...
Thrush asked 12/11, 2013 at 17:4

2

Solved

I am reading The Hitchhiker’s Guide to Python and there is a short code snippet foo = 'foo' bar = 'bar' foobar = foo + bar # This is good foo += 'ooo' # This is bad, instead you should do: foo =...
Unfrock asked 24/9, 2016 at 11:37

2

Solved

I would like to do the following more efficiently: def repeatChar(char:Char, n: Int) = List.fill(n)(char).mkString def repeatString(char:String, n: Int) = List.fill(n)(char).mkString repeatChar('...
Saccharify asked 26/7, 2015 at 12:46

© 2022 - 2024 — McMap. All rights reserved.