Most voted "string-interpolation" questions
16 questions
Sort by count of
-
49
votes1
answer2641
viewsWhat does the symbol "$" mean before a string?
Viewing a code here in Sopt, I noticed the use of the symbol "$" and I was left with doubt about its use. What is the symbol "$" before a string? What good is he? Why use it? Example using static…
-
12
votes2
answers720
viewsWhat Means Two Keys in Javascript
I understood the "===" that tests value and type, different from the "==" that tests only value, but I didn’t understand the double key, type: {{alguma_coisa}}, for example in a Javascript that I…
-
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
votes4
answers8429
viewsHow to use template string in Javascript?
I’m having trouble making a Javascript function that I pass a string and an object and it fills this string with the attributes of that object, for example: var user = { nome: "danilo", idade: 29 };…
-
8
votes2
answers5568
viewsHow to interpolate string in Python?
For example, in PHP, we can do so: $preco = 200; $unidades = 10; $texto_final = "O produto custa {$preco} reais e restam {$unidades} unidades."; You can do something similar in Python or you must…
-
7
votes4
answers1385
viewsHow to replace {vars} in a string?
I have a string string str = "Bem vindo {Usuario}. Agora são: {Horas}"; I want to replace {Usuario} by a name and {Horas} by the current time, how can I do this?…
-
7
votes2
answers3695
viewsUsing string interpolation C# 6
With C# 6 and interpolation usage is better than concatenating string with data. As in the example. Instead of: var d = "19"; string.Format("{0} anos", d); looks much better $"{d} anos"; But using…
-
4
votes1
answer157
viewsLibrary equal to C# 6.0 runtime Interpolation string
Does anyone know of a library that interpolates at runtime on strings? I know it could be done using Replace(), but I don’t want to pass the list with all the variables. For example: Programa de…
-
2
votes2
answers660
viewsPrint associative array element inside string without concatenation
I have to print out a tag HTML via a echo with the value of a array associative, however I can’t make it print to be concatenative use. Code .php (this way is not working, I believe by the quotes…
-
2
votes2
answers65
viewsGet two snippets of a confusing string
*It’s very simple my question: How do I get the string Argumento1 and the string Argumento2, separated into two variables in this code of a language that I’m doing: if Argumento1 = Argumento2 (…
-
2
votes1
answer65
viewsHow to get a value using interpolation?
I am trying to recover a class value using interpolation. Using Console.WriteLine($"Meu Nome é, {pessoa.Nome}");, I get the value of the form I want, but in my case the string will come from a…
-
2
votes1
answer1417
viewsMount SQL query in Python3 from data in a dictionary
I’m trying to format a query and leave it this way: INSERT INTO users('username', 'password') VALUES ('meuusuario', 'minhasenha') But you’re returning me with []: INSERT INTO users(['username',…
-
1
votes2
answers194
viewsEnhanced truncation of strings
I was going over some old codes when I found a function that "truncates" a given string after X characters: This function, unlike a replace() simple, does not leave the developer in awkward…
-
1
votes1
answer849
viewsHow to break lines using template string (ES6)?
I have a request for the back-end and your URL is very large. this .$http .get(`backoffice/usuarios/${this.id}/grupo/${this.grupo}/filial/${this.filial}/multinivel/${this.multinivel}`) .then(({ data…
javascript vue.js string-concatenation string-interpolationasked 6 years, 6 months ago guastallaigor 1,294 -
1
votes1
answer38
viewsError printing variables of a class object in code
When executing the code ends up returning me the following: Oi, meu nome é Instance of 'Pessoa'.nome, tenho Instance of 'Pessoa'.idade anos e meu pseudônimo é Instance of 'Pessoa'.pseudonimo. The…
-
0
votes0
answers63
viewsHow to interpolate constants?
Why don’t these interpolations work and how to make them: class Foo { const BAR = "baz"; } define("TAZ", "qux"); echo "Foo::BAR={Foo::BAR} TAZ={TAZ}"; //Foo::BAR={Foo::BAR} TAZ={TAZ} echo…