1115
Views
5
Comments
Proper casing issues

Hi community


I'm trying to convert the first letter of each input text field to upper case. For example "john" would become "John". This input text is validated from a form. How would I go about doing this? I have tried methods, which don't work such as:

Substring(), combined with the ToUpper function but this only returns the first letter of the word.

Regards

Yoonus

2020-02-28 09-46-54
Eduardo Jauch

Hi Yoonus,

It is important to understand why do you need to capitalize the first work in a form. Personally, I would never do this. If the user wants to type it all in lower case, its up to him.

I think there is no function to Capitalize, but in any case, you can do something like this:

variable = ToUpper(SubStr(text, 0, 1)) + SubStr(text, 1, Length(text))

Function names can be different (took from the top of my head).

Cheers,
Eduardo Jauch

2024-03-25 06-19-08
Harlin Setiadarma

There is no InitCap function in Outsystems.

You must make it yourself.

2024-03-25 06-19-08
Harlin Setiadarma

Btw, I made a quick Initcap action...

OML attached (mixed in with another demo for other thread in OS Forum).

Live Demo: https://harlin.outsystemscloud.com/TestDropdownCarousel/InitCaps.aspx

TestDropdownCarousel.oml
2024-03-25 06-19-08
Harlin Setiadarma

I agree with Eduardo Jauch.

The problem with Initcaps, especially if forced in Input Field is:

john smith (CEO) will become John Smith (ceo)

james a.g. will become James A.g.

John Smith PhD will become John Smith Phd

UserImage.jpg
stephen hays

No but if you are trying to capitalize the name of a city "plant city"  it will work may not work on all things but will work on most things it all is how you organize the data.  

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