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.

6 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:

6 Likes

Bump. Vote. Super useful feature for debugging and much more human readable, humanCollaboration++

1 Like

Are there any updates on this feature?

I’m combining a lot of strings, and this feature would really save my time.

2 Likes

Not implented ? I got the BC30037 error …

This would be a nice improvement to UiPath to be able to use interpolated strings, it would be much easier to make changes and create more complex strings.

Well, I think this String.Format should work OK for the time being!

String.Format(“This is a string with a first name {0} and a last name {1}”, first_name, last_name)

BUMP, Voted, it would be very nice to have normal string interpolation please add it! :smiley:

Any update on this? String interpolation is a feature that’d be really, really, nice to have.

Just to close the loop on this topic.

I’ve tested this on either a vb.net or a C# project in Studio 2023.8.0 Community Edition and this is the result in both cases :slight_smile:

3 Likes

Hello, as a former c# developer it’s a big comfort to have string interpolation in UiPath, thanks for this information!

However, I always thought it wasn’t working for a simple reason, we don’t have intellisense enabled inside brackets. I would have expected same behavior as visual studio, everything inside brakets should be in white and should enable intellisense.
Do you know if anything is on backlog to implement this ?

Have a nice day !

2 Likes

@loginerror I was actually wondering about this recently as well. The string interpolation feature is great to have, but I fear the usefulness is limited if intellisense does not work when brackets are in the statement, as @Matt67 mentioned.

Lately, my way of getting around this is by taking the variables I want to use Intellisense for out of the statement and then put them back in. But at this point, it is only marginally better than string.Format.