toUpperCase doesn't work properly

Hi there,

I am struggling with a basic text transformation :frowning:

Here’s my example :

I’m trying to get the text transformed to get only the first letter capitalized.

For example :
test == Test
TEST == Test

I though it’d work using “to.UpperCase” function, but it didn’t. It work only in the case of “test”, but if I enter “TEST” as an input, then it doesn’t work.

Does anybody have any idea, please ?

Thanks a lot !

It looks like your topic is missing some important information. Could you provide the following if applicable.

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:

Hey @RomainMaltrud,

.toUpperCase() is a javascript function that converts text to upper case (String.prototype.toUpperCase() - JavaScript | MDN) if you are using TEST and converting the first character to uppercase I would expect the output to still be TEST as it is uppercase already.

Instead of doing that what you could do is use an Edit Fields node like the example workflow below and use .toTitleCase() or if you wanted to use the code node method try converting the entire string to lowercase first then changing the first value.

1 Like

Hey Jon,
Thank you very much for your quick answer.
I’ve tried .toTitleCase in my previous workflow but got the error that this function doesn’t exist.
However, with your example, IT WORKS !

Thank you so much !

1 Like

Hey @RomainMaltrud,

Oddly toTitleCase() is not an offiical javascript function it is a helper function we added to make life easier when using expressions :slight_smile:

You can find a list of them here: Data transformation functions | n8n Docs

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.