1
 Follower
19
 Likes

String Formatting

Builtin & User functions
New

Add support for string formatting in Expressions like python code.


In Outsystems we have something like this:

"My name is " + Name +" and I'm from  "+City


My ideia is to implemenmt something like this:

"My name is %s and I'm from %s " % (Name, City)

Created on 4 Feb
Comments (8)

It could be amazing the use of patterns like string interpolation as .NET and other languages 

$"My name is {Name} and I'm from {City}"  Much cleaner and without counting number of tokens in big string formattings.

or C# pattern for string.format("My name is {0} and I'm from {1} ", Name, City)

Cheers,

Agree with Marcio. I'd work great in current web javascript editor. Having all that concatenations is really annoying.  I prefer $"My name is {Name} and I'm from {City}"

Changed the category to Builtin & User functions


I don't agree with this, the idea is a low-code platform. 

Creating a new formatting function instead of simply write the sentence in the way you need, doesn't help in anything, don't see any advantage.

Totally disagree with you Nuno. It happens very often you need to display text with variables, and using concatenation has a number of drawbacks, especially when using translations. I'm very often doing something like:

Replace("I have {0} bottles of beer on the wall", "{0}", IntegerToText(BottleCount))

in order to prevent concatenation in my code (and yeah, I should make that into a Function...).

Until now I didn't notice the need for having that kind of function, but I'm not against the creation of that function.

It was more a kind of warning to avoid that we lose the low-code concept.

But thanks for the heads up Kilian.

I think Roman's idea is better than the suggested one.

+1 for Roman's Idea

views
361
Followers
1