31
Views
9
Comments
Solved
Convert the first letter with upper case
Question

Hi community


I'm trying to convert the first letter of each input text field to upper case. For example "raHul" would become "Rahul". I am using below method but its convert first letter .
Is any one method available in outsystems ?
Ex. String as a input parameter and its convert it with first letter with upper case and remaining string lower case.

ToUpper(SubStr(Name, 0, 1)) + SubStr(Name, 1, Length(Name))

Regards
Rahul Jain

Rank: #397
Solution

Rahul Jain wrote:

Hi community


I'm trying to convert the first letter of each input text field to upper case. For example "raHul" would become "Rahul". I am using below method but its convert first letter .
Is any one method available in outsystems ?
Ex. String as a input parameter and its convert it with first letter with upper case and remaining string lower case.

ToUpper(SubStr(Name, 0, 1)) + SubStr(Name, 1, Length(Name))

Regards
Rahul Jain

 Hi,

Its is very simple, no need to write code. Just use this css - "text-transform: capitalize;"

 

Rank: #144

Hello Rahul,

Your text allows only one word or is it allowed more than just one?

You can use ToUpper function for your first letter and ToLower function for the rest of the letters.


Kind regards,

Rui Barradas

mvp_badge
MVP
Rank: #75

Hi Rahul,

There are also a few string manipulation components available on the Forge.

One of which is String Utils which has a function UpperCaseFirst() that you can use.

  • string UpperCaseFirst(string input) 

Returns a new string upper casing the first character of the input.

Regards,

Nordin

Rank: #90

Hi Rahul,

Use this expression for your case

ToUpper(Substr(Name,0,1))+ToLower(Substr(Name,1,Length(Name)))


Hope this will help you.

Regards

Rahul

Rank: #144

Hello again Rahul,

Please refer to attached OML.

As you can see, here's the expected result:


Kind regards,

Rui Barradas

ConvertFirstLetterUpperCase.oml

Rank: #132

Hi Rahul,


You almost got it right :)

The below expression does the trick:


ToUpper(SubStr(Name, 0, 1)) + ToLower(SubStr(Name, 1, Length(Name) - 1))


If you're seeking to apply this to multiple words, you don't need to reinvent the wheel, the CamelCase component does what you need.


Hope it helps.


Cheers,

João

Rank: #144

Hello Rahul,

Unfortunately, there is no Built-In function to do that logic by default.

But you can always create your own common function with that specific logic and use it across your application :)

This will allow you to call your function instead of that script when you need it.


Kind regards,

Rui Barradas

Rank: #144

Something like this:



And then you can just call this function where you need it (instead of using the script):


Hope that this helps you!


Kind regards,

Rui Barradas

Rank: #397
Solution

Rahul Jain wrote:

Hi community


I'm trying to convert the first letter of each input text field to upper case. For example "raHul" would become "Rahul". I am using below method but its convert first letter .
Is any one method available in outsystems ?
Ex. String as a input parameter and its convert it with first letter with upper case and remaining string lower case.

ToUpper(SubStr(Name, 0, 1)) + SubStr(Name, 1, Length(Name))

Regards
Rahul Jain

 Hi,

Its is very simple, no need to write code. Just use this css - "text-transform: capitalize;"