1,146 questions
0
votes
1
answer
98
views
Macro-free, MSVC-compatible std::format with check for extra argument
I use std::format in my logging, and it largely works great. However, std::format ignores extra arguments which I do not like. E.g., std::format("x = {}", x, y) compiles, so I want a ...
2
votes
2
answers
179
views
How does interpolating a Perl constant into a string work?
I've just come across such usage of Perl constants:
use strict;
use warnings;
use constant PI => 4 * atan2(1, 1);
print("The value of PI is: ${\PI}\n"); # The value of PI is: 3....
0
votes
1
answer
56
views
Powershell: Using dimensions on Microsoft.Compute/virtualMachines metrics [duplicate]
I am following https://learn.microsoft.com/en-us/azure/azure-monitor/reference/supported-metrics/microsoft-compute-virtualmachines-metrics to export some metrics from Azure.
If build some code that ...
2
votes
1
answer
82
views
Why use this syntax `{": "}` in React instead of just writing a colon
I saw this code snippet on the React dev page (https://react.dev/reference/react/memo#updating-a-memoized-component-using-state):
export default function MyApp() {
const [name, setName] = useState(''...
1
vote
1
answer
68
views
Scala StringContext, how can I intercept expressions before evaluation?
I'm trying to use the Scala extensions to extend the String context to time the execution of a costly method And I came with this:
extension(sc: StringContext)
def timeit(args: Any*): String = {
...
-1
votes
1
answer
87
views
Terraform pass generated value as variable to User_Data
When deploying a Windows EC2 instance with Terraform, I want to create a user using the User_Data template. I am also passing a random_password variable to the template.
In the main.tf I have:
...
0
votes
1
answer
49
views
String interpolation returning unexpected result
I have a data class Shift:
@Serializable
data class Shift(
@SerialName("id") val id: String,
@SerialName("username") val username: String,
@SerialName("start")...
19
votes
1
answer
2k
views
Escape braces in C# interpolated raw string literal
I need braces in a raw string literal that uses interpolation:
var bar = "Bar";
var s = $"""
Foo
{bar}
Baz
{{Qux}}
""";
Console.WriteLine(s);
I expect ...
0
votes
0
answers
27
views
Vue text interpolation watches all elements?
Consider the following simple example.
Two counters are rendering, once with ref that gets updated every second and one static:
<script setup>
import { onMounted } from 'vue';
import { ref } ...
1
vote
2
answers
184
views
How can I combine unicode with string interpolation in Swift UI?
Hoping you can help - this may be a simple question.
I've got a list of the unicode values of emojis, and I'm trying to randomly display one. Here is where I'm hardcoding displaying the smiley:
...
0
votes
1
answer
364
views
Terragrunt string interpolation on generate block
Having a hard time trying to make this work.
I'm trying to use the generate block to add a for_each and run the module multiple times depending on how much entries I have in the variable s3, but ...
5
votes
3
answers
231
views
How can I write a happy birthday message in Ruby to put on a cake? [closed]
Original Question
My boyfriend is celebrating his birthday shortly and I am ordering a custom cake for him. I want to write Happy Birthday on it in a clever Ruby coding way. It will be on a black ...
0
votes
0
answers
32
views
Perl how to read a line from a file with interpolation of embedded new line char [duplicate]
I am trying to print a line from a file with interpolation.
I have the following code:
open FH, "<", "file.txt";
my $line = <FH>;
print "line = " . $line . "...
1
vote
1
answer
287
views
Terraform doesn't let me join a string to a variable in for loop to reference another variable
I am sure this is not a unique requirement and I have delt with this type of issue using eval() syntax in few other programming and scripting environments.
My problem: I am trying to create a ...
-1
votes
1
answer
781
views
Why does Java's string templating use clumsy STR prefix? [closed]
Java finally supports string interpolation! I'm very happy about it. However, the syntax seems to me a bit clumsy
// string templating syntax from Java 23
String greeting = STR."Hello \{name}!&...
1
vote
1
answer
36
views
Overriding HashMap.toString() in string interpolation contexts
I am trying to create a subclass of HashMap with its own string representation. I figured that I just needed to override toString() in the subclass:
class Foo extends HashMap {
String toString() {
...
0
votes
1
answer
51
views
String Interpolation Issue Jupyter Notebook Pyspark
I am passing in the following as a query (.dbtable) to pyspark, running in jupyter notebook on AWS EMR.
num = [1234,5678]
newquery = "(SELECT * FROM db.table WHERE col = 1234) as new_table"
...
0
votes
1
answer
133
views
Groovy Yaml string interpolation with a list of maps
I am building a yaml string within Jenkins scripted pipeline that is parametrized.
The problem is that I get error interpolating string with a variable that is a list of maps.
I don't think I can use ...
0
votes
0
answers
26
views
invoke-webrequest fails with special characters [duplicate]
I am using a release pipeline to get a valid token, the client secret, and the user password via Azure Key Vault I am getting the client secret, and the user password. I did some tests and saw that ...
0
votes
1
answer
336
views
How to accept any variable type that can be used in SwiftUI Text view
I'm trying to create a reusable component for presenting a Swift collections OrderedSet into a SwiftUI List with delete, move and add handlers.
I would like to be able to pass in an OrderedSet of any ...
-1
votes
1
answer
1k
views
Jenkins groovy string interpolation using a combination of secret and non secret values [duplicate]
I have a shell command in my Jenkins script that uses string interpolation for non secret values as well as secret values.
For non secret values, you are expected to use double quotes and the string ...
0
votes
2
answers
118
views
Ruby Variable Interpolation in Array Names
I have a few similarly named arrays and I need to loop through the array names:
level_1_foo
level_2_foo
level_3_foo
level_4_foo
level_5_foo
I'd like to do something like the following where x is the ...
0
votes
1
answer
330
views
String interpolation, string formatting and null coalescing operator at once
I need this:
If the following formatted value is null, display N/A. Otherwise, display the formatted value. It needs to be with string interpolation. I tried to do something like nested interpolation:
...
0
votes
0
answers
311
views
micronaut httpclient is replacing ampersands and equal signs in my url, but I dont want it to
Short Version
after reading the httpclient logs, I'm seeing that some characters are being url-encoded. I dont want that to happen.
Long Version
the url I'm calling is split into <base url>+<...
1
vote
2
answers
195
views
Replace the name of a VB6 string variable inside a string by the contents of that string variable?
tl;dr
Skip to PROBLEM below.
CONTEXT
In my algebraic math program a formula can be entered in the following forms (as lines of VB6 code). (Spaces within strings will be ignored):
formula1$ = "SUM ...