1,148 questions
- Bountied 0
- Unanswered
- Frequent
- Score
- Trending
- Week
- Month
- Unanswered (my tags)
4
votes
2
answers
162
views
Trouble accessing a single element of an array in Powershell [duplicate]
I am attempting to use a single element of an array, when creating a string message, but it is using both elements, concatenated by a space, whether I use $myArray[0] or $myArray[1]...
# Multiple ...
2
votes
1
answer
65
views
backslash count in raw string interpolation in scala
I am using Scala 3.3.7.
When I do
val str1 = raw"\\\" // compile error: unclosed string literal
It is considering the \" as a single character.
But when I do
val str1 = raw"\\\\&...
0
votes
1
answer
114
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 ...
1
vote
2
answers
125
views
How to extract string between delimiters [duplicate]
Let's say I have a string:
$line = "name=""abc"""
I want to extract whatever is written within the quotation marks, like this:
[regex]::Matches($line,'(?<=name="...
2
votes
2
answers
182
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....
1
vote
1
answer
59
views
Variable interpolation
I am trying to interpolate variables within an Ansible play. I have the following variables:
target_hostname
user_account
account_password
user_account_password is in a vault, and the variable is ...
0
votes
1
answer
64
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 ...
0
votes
0
answers
30
views
How can I find a translatable string by ID?
In the messages file of my multilingual Angular project, I have strings that only contain {$INTERPOLATION} and nothing else. These obviously don't need to be translated. They are mistakes, where there ...
2
votes
1
answer
84
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
2
answers
72
views
How to avoid memory allocation in catch block in Java Spring application (string interpolation)?
I am writing a Java Spring Boot (servlet) web-API application. There are repository classes in the application. Repository methods are written "from scratch" using Google Cloud Datastore API ...
1
vote
1
answer
69
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 = {
...
0
votes
0
answers
70
views
Does string interpolation StringBuilder internally? [duplicate]
Note: this is not a duplicate of the question here. That one asks about string concatenation, which is different from string interpolation.
Consider this example of string creation in C#:
var str = $&...
-1
votes
1
answer
94
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
57
views
Dart string interpolation - invalid constant value
I am trying to follow this dart guide https://codelabs.developers.google.com/codelabs/dart-patterns-records#4 but ran into an issue with string interpolation.
I am totally puzzled why dart expects a ...
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")...