Most voted "string-concatenation" questions
The tag can be used for any language, so use a language tag together. String concatenation is the union operation of two strings generating a single string.
Learn more…101 questions
Sort by count of
-
31
votes4
answers28968
viewsWhat is the most appropriate way to concatenate strings?
There are different methods for concatenating strings, such as Concatenating with the operator "abc" + str Formatting String.Format("abc{0}", str); Using the Stringbuilder new…
-
11
votes1
answer27744
viewsConcatenate Strings into Java Loops - Stringbuilder or '+'?
Java allows us to concatenate Strings in Java using only the operator '+' String str = "a" + "b" + "c"; It’s a simple way to do the job, and much less verbose than with Stringbuilder. But in cases…
-
11
votes2
answers70082
viewsHow to concatenate multiple Strings in Python?
The following method c.filtraNome(nome) carry out a consultation at the bank (sqlite3), however, I don’t know how I can group each field and return the already formatted query in the following way:…
-
10
votes2
answers455
viewsString Interpolation performs better than string. Format?
I use Resharper and a few days ago I started using some C# 6 features. In various parts of the code use string.Format() and I realized that Resharper suggests that these snippets be replaced by…
c# .net string string-concatenation string-interpolationasked 9 years, 1 month ago Jéf Bueno 67,331 -
9
votes5
answers7529
viewsHow to search recursively using grep
How to search for a given word recursively in all files in the current directory and its subdirectories? I tried to travel with: find . | grep "palavra"
-
7
votes4
answers4319
viewsString concatenation in SQL
I perform a query in a table in my Mysql database that returns the following fields to me: usuarioId nome sobrenome idade sexo escolaridade modeloNome hora Follow the sql below: SELECT…
-
7
votes1
answer17403
viewsWhat is the best way to concatenate strings in Python?
I know I can concatenate strings with +=, +, join() and append(). They all give me the same result when I concatenate two strings. What is the best way to concatenate Python strings? What is the…
-
6
votes4
answers35368
viewsExplanation about concatenation of variables in PHP
I always wonder how to concatenate strings with variables in PHP. I have some difficulty understanding the question of double or single quotes. I would like an answer to clarify why one or the other…
-
6
votes5
answers23456
viewsAdd character in the middle of a string
Problem How to add character in the middle of a javascript string? For example: var string = "aacc"; // eu quero colocar as letras bb no meio da aa e cc I want the string be of such value aabbcc How…
-
6
votes2
answers737
viewsConcatenate fields in a more performative way
I am concatenating the description lines of a record so that instead of having N records for a description it has only one. I can make it happen, but I wanted a more performative way, because I’m…
-
5
votes1
answer6021
viewsHow to concatenate two strings?
Supposing I have two strings, Olá and mundo!, as I grant them using R?
-
5
votes1
answer716
viewsWhat is the difference between the "+" and "&" operators when concatenating strings?
In VB.NET, there are two operators I use in concatenating strings, the & and the + (I know there are more efficient methods for concatenating strings, but in this question, I pay attention only…
-
5
votes3
answers349
viewsWhat are the advantages of using PHP’s sprintf function?
I can see an advantage in using the function sprintf in place of concatenation: readability. In addition to readability, what are the other advantages of sprintf() in relation to concatenation? Is…
-
4
votes4
answers1394
viewsHow to concatenate two byte arrays in Java?
I have: byte mensagem[]; byte nonce[]; How do I concatenate the array nonce at the end of the array mensagem and store in a third array?…
-
4
votes1
answer177
viewsVBA for searching photos in a folder and concatenating filenames without duplicating
In February I asked for help in a code to group photo names I have in a folder (product photos) belonging to the same product, such as can be seen in this other question. My problem has been solved,…
-
4
votes2
answers6935
viewsConcatenate values from the same column
How to concatenate the values of the same table Table example | Usuario | Formulario | Acao | Permitir | | Admin | Contrato | Imprimir | 1 | | Admin | Contrato | Consultar | 1 | | Admin | Contrato |…
-
4
votes1
answer1398
viewsWhen to use String and Stringbuilder
There is another question about What is the most appropriate way to concatenate strings?. It explains the possible types of concatenations in C#. But when should we use System.String and when we…
-
4
votes2
answers214
viewsTrying to understand the Java print
Watch the code right below; public class Dois { public static void main(String[] args) { int a = 3; int b = 4; System.out.print(" " + 7 + 2 + " "); } } The score is 72, but I thought the result was…
-
3
votes2
answers635
viewsHow to split a string with delimiter in PHP?
have a string "1b00bd515bf8cbc5a86f3b714361fab6" and I want to share it that way: "1b00bd51-5bf8cbc5-a86f3b71-4361fab6" HOW DO I DO?…
-
3
votes1
answer124
viewsWhen concateno String add a ENTER
When I concateno(+) strings adds one alone enter right after the concatenation. private static Dimension TOOLKIT = Toolkit.getDefaultToolkit().getScreenSize(); private static GraphicsEnvironment GE…
-
3
votes2
answers233
viewsError: "invalid operands to Binary Expression ('char *' and 'char *')"
I need to create a string which contains "Mr: n" and the name of the person concerned (pessoa->nome). char* endereca(Pessoa* pessoa) { if(pessoa->sexo == 'M') { char *msg; msg =…
-
3
votes2
answers2354
viewsConcatenate arrays using numpy module
One question, for the solution of linear systems: how to concatenate an array (matrix) A, an array (column vector) b, so that one has the "augmented" matrix of the system, A~ = [A b], using numpy?…
-
3
votes2
answers169
viewsWhen to use Stringbuilder and Stringbuffer instead of concatenating with "+" operator in Java?
What are the benefits of concatenating a string using StringBuilder or StringBuffer instead of simply using the operator +?
-
3
votes2
answers2007
viewsConcatenate Strings in C
Good afternoon, you guys! I have a problem in Strings using the C Language. The problem asks the user to enter a name, then to enter a special character, and finally how many times he wants the…
-
3
votes2
answers724
viewsConcatenate variables in the Django template
Talk guys, good morning, I have a problem. I’m walking through a lista but I want to concatenar my list I’m calling on template as {{ list }} and {{ forloop.counter0 }} so that in mine is only…
python django list django-templates string-concatenationasked 6 years, 1 month ago Raphael Melo De Lima 461 -
3
votes2
answers476
viewsTranslating copy command from CMD to Powershell Copy-Item
I’m trying to translate a command from cmd to the powershell but I’m not getting it. I get multiple.txt files during the month, put them all in the same folder, some have specific terms in the name…
-
3
votes1
answer47
viewsHow to concatenate columns identified by surname?
I have the following appointment: select case when datediff(...) > 0 then month(tblData.data1) when day(tblData.data2) > 10 then month(tblData.data2) when month(tblData.data2) = 1 then 12 else…
-
3
votes3
answers713
viewsCombination of two lists in Python
I need a code that discovers possible passwords in a universe of LLLDDD (L=letter, d=digit), I found it easier to apply the conditions separately and I arrived at two lists: lpossiveis:['ABD',…
-
2
votes4
answers1944
viewsRun query that concatenates parameters (@p) in Firebird
I need to run a query where the value to be concatenated must be passed as a parameter for the query. SELECT t.id || @p || t.nome FROM Test t; But when executing this query it returns the following…
-
2
votes2
answers438
viewsHow to give ALIAS with current "month/year"?
Considering the query below, I need the ALIAS where there are SOMAS, to be "nomeMes/anoAtual" ("ABR/14","MAI/14"...) dynamically. SELECT fornecedor.codigo, UPPER(fornecedor.razaosocial) AS…
-
2
votes2
answers497
viewsHow to concatenate two Data?
How to concatenate two dates of the type DateTime, one of which may have its value equal to NULL, I’m trying this way; DECLARE @DATA1 DATETIME = GETDATE(), @DATA2 DATETIME select…
-
2
votes2
answers91
viewsAdding the same substring to multiple columns in R
I have a base with 2 lines and 68 remarks called "varnomes" and would like to add the word "PF" at the end of each remark. With that, I tried to use the function Paste:…
-
2
votes2
answers459
viewsJavascript concatenated into input name
Is there any way to concatenate a variable javascript next to a input? That one input hidden i would submit together to an HTML form For example: <script type="text/javascript"> var…
-
2
votes6
answers1851
viewsInterlink two strings into one vector
/** 5. Faça um programa que receba 2 strings (A e B) e retorne uma terceira string (C) formada pelos caracteres de A e B intercalados. Ex.: Se A='Quarta' e B='Segunda', a resposta deve ser…
-
2
votes1
answer104
viewsWhy does adding a variable, property, method, etc. to a string work?
When I add a variable, property, method, enumerator, etc. into a string, it works, even though I’m not calling the method ToString() for example. Example with type and integer: var example =…
-
2
votes1
answer111
viewsimplode() vs substr()
Taking into account the codes below: $str = ''; for ($i = 30000; $i > 0; $i--) { $str .= 'STRING QUALQUER, '; } $str = subtr($str,0,-2); and that $sArr = array(); for ($i = 30000; $i > 0;…
-
2
votes0
answers46
viewsJoin Separate Fields in a Cell
Guys, I’m doing this code, but I wanted the P.O field to divide into the P.O values, but it only pulls one field, so it does that in the division .... Sub CalcularNotas() ' pl_Respostas.Unprotect…
-
2
votes1
answer82
viewsMerge Names into a line
Good afternoon we use SQL SERVER 2008 as the official database server and we have the following query : SELECT P.NOME AS [PROFESSOR], STIPOCURSO.NOME AS [NÍVEL DE ENSINO], SPL.CODPERLET AS [ANO],…
sql sql-server query sql-server-2008 string-concatenationasked 6 years, 8 months ago Nathann L. J. Lima Alcantara 21 -
2
votes2
answers141
viewsIs it recommended to use memset before strncpy?
Usually when we want to copy the contents of a particular string into another string we can use the functions strncat or strncpy. Using strncat The use of strncat to copy strings is kind of "wrong"…
-
2
votes1
answer1207
viewsHow to concatenate variable names in Java
I’m having a question. I’m wanting to generate a total of variables, from a for, to not have to write all of them, but I’m not able to concatenate the names of variables. I’m trying this way:…
-
2
votes3
answers180
viewsMysql - Create an alias by concatenating multiple fields
Is it possible to create an alias by concatenating other fields? Ex: SELECT u.nome, u.sobrenome AS nome_completo FROM usuarios u In the example, I want to concatenate u name. and u surname. and…
-
2
votes1
answer1999
viewsSyntaxerror: invalid syntax, what happened?
I am using Python 3.7.4, I tried to write several different ways and nothing worked. character_name = "Johnny" character_age = "64" print(+character_name "is cool.") print("And he is " character_age…
-
2
votes2
answers50
viewsJavascript concatenation with PHP
$(document).ready(function() { var max_fields1 = 6; var wrapper1 = $("#container1"); var add_button1 = $("#add_tipo_telha"); var x = 0; $(add_button1).click(function(e){ e.preventDefault(); if(x…
-
2
votes2
answers114
viewsIs there a way to interpolate strings in Java?
I’m starting in Java and found the path to concatenate String and variables very tiring. In Javascript, we can use `string ${variavel}`; in Python, 'string {}'.format(variavel) or f'string…
-
1
votes2
answers1236
viewsVBA for directory search and concatenating filenames
I need to evolve the following code to do the concatenation of data in a certain way. I have a folder with photos of products, (several photos for each product) and I want Excel to do a search by…
-
1
votes2
answers216
viewsReturn information from a String
I’m trying to return the information from a String. What I need is to pass a String parameter and return the information that is in the indicated places. Ex.: String FraseParametro = "<R1>…
-
1
votes1
answer213
viewsHow to improve string comparison and concatenation C#
I have the following code: private static string MontarDescricaoOrgaoUoUe(RequisicaoFisica requisicao) { return !string.IsNullOrEmpty(MontarNomeOrgao(requisicao)) ? MontarNomeOrgao(requisicao) :…
-
1
votes4
answers1821
viewsString and variable concatenation problem in jquery load function
Follow the full Javascript code: var idcl = document.getElementById('idcl').value; $(document).ready(function(){ $('#estados').change(function(){…
-
1
votes0
answers22
viewsGrunt Concat Does Not Unify Files
I want to unify my css files into one, but Grunt doesn’t unify. It works perfectly for javascript. Follows: concat: { options: { separator: '\n\n', }, css: { src: [ 'dist/app/css/*.css' ,…
-
1
votes0
answers61
viewsArray vector has "n" elements, but lenght returns "n+1" in C
Hello, I have the following question: I have a vector and I’m sure it is passed to him only one element through the following loop: char uid[1]; while(indice1 < indice2){ printf("Valor de indice…