1688
Views
10
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

2018-12-01 17-54-01
Sourav Pasari
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;"

 

2020-05-07 18-53-00
Rui Barradas
 
MVP

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

2021-08-12 11-00-27
Nordin Ahdi
 
MVP

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

2022-10-18 07-32-49
Randall Jodache Chetty

Thanks for sharing 

2026-02-26 06-29-24
Rahul
 
MVP

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

2020-08-31 05-04-40
Rahul Jain

Rahul Sahu wrote:

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

 

 Is any one function not available in outsystems ?
Like ToUpper , ToLower. Or Every time i have to call this script
ToUpper(Substr(Name,0,1))+ToLower(Substr(Name,1,Length(Name)))

2020-05-07 18-53-00
Rui Barradas
 
MVP

Hello again Rahul,

Please refer to attached OML.

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


Kind regards,

Rui Barradas

ConvertFirstLetterUpperCase.oml
2018-10-29 08-31-03
João Marques
 
MVP

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

2020-05-07 18-53-00
Rui Barradas
 
MVP

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

2020-05-07 18-53-00
Rui Barradas
 
MVP

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

2018-12-01 17-54-01
Sourav Pasari
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;"

 

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.