String Interpolation

Is there any plan to incorporate the updates to .NET languages - and visual basic - to allow for string interpolation in UiPath Studio. Instead of string.Format(“This is a string with two variables {0} and {1}”, variable1, variable2) you can now just type $“This is a string with two variables {variable1} and {variable2}”. Obviously this isn’t much of a savings with small number of variables, but when formatting a string with five or more variables, the new way of string interpolation is much simpler and reduces the chance of error.

4 Likes

Any news here, this would be a neat feature.

2 Likes

Hi @nickboswell

I added it to our ideas tracker. Our product team will consider it. In the meantime, feel free to vote this feature up to increase its chance of being implemented :slight_smile:

3 Likes

Noticed that C# is added to the 2019.7 release - awesome. Did try string interpolation with no luck. Shouldn’t it be available - along with other built in .NET features - when running .NET 4.6+?

Thanks

// André

Hi @Andre_Viebke

Given it is experimental support for now, it might be that some bugs still need to be reported :slight_smile:

Feel free to report directly from Studio, given that 2019.7 brings this functionality as well:

Thanks for your quick response, will do.

// André

1 Like

String Interpolation would allow for easier creation of string messages.

The following message:

"Number of transactions " + TransactionData.Rows.Count.ToString + ", with the last processed being " + TransactionNumber.ToString + " with current status " + TransactionStatus

Would turn into:

$"Number of transactions: {TransactionData.Rows.Count}, with the last processed being {TransactionNumber} with current status {TransactionStatus}"

It’s a much cleaner way to express the same information, and I would strongly suggest its inclusion.

It’s synonymous with:

String.Format("Number of transactions: {0}, with the last processed being {1} with current status {2}", TransactionData.Rows.Count, TransactionNumber, TransactionStatus)

However, this method removes the declaration from the string, which makes it hard to figure out where each belongs.

1 Like

@dmccammond

Edit: Already supported in the latest versions C# 7.
I voted for the feature.

Regards,
Karthik Byggari

I’m sorry @KarthikByggari, I don’t follow. As I understand it, the code in managed languages is passed to a (language dependant) compiler, which produces “common” bytecode. That bytecode then gets thrown into the CLR, which converts it into native code.

There is support for string interpolation in the compiler already, so why can’t we have it? I’m really curious, because IMO this is a feature I’d love to have.

I’ll add that to multiline strings literals, which have been a thing for a while, but we can’t use them in UiPath studio :frowning: .

EDIT: Found it, both string interpolation and multiline string literals were implemented in VB14. That was January 2015!

3 Likes

Sorry my mistake @Byte .
Now the recent releases had a support for string interpolation.
We have this feature in C# 7 release. I didn’t check in VB. I missed it.

In C#, syntax goes like this

$"This is string interpolation syntax with {variable1} {variable2}"

Regards,
Karthik Byggari

5 Likes

Hi @loginerror,

Was wondering if there’s any news on this subject?

I have to prepare very long XML requests for SOAP services that can have dozen of variables, and the string interpolation limitations are killing me…

I try to keep my automated email reports to a bare minimum because of this same reason, String.Format becomes a nightware if you’re trying to use 60 variables, the thought of debugging that still wakes me up at night sometimes. :smile:

3 Likes