Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NodeJs: Upper case a string

Tags:

node.js

I want to Upper case a string, I've tried this, but none of them works

format.printf((info:any) => `${info.timestamp} ${upperCase(info.level)}: ${info.message}`)
format.printf((info:any) => `${info.timestamp} ${capitalize.words(info.level)}: ${info.message}`)
format.printf((info:any) => `${info.timestamp} ${capitalize(info.level)}: ${info.message}`)
like image 794
Sandro Rey Avatar asked May 16 '26 16:05

Sandro Rey


1 Answers

Try to use JavaScript built-in function toUpperCase().

Something like below.

var str = "Hello World!";
var res = str.toUpperCase();

console.log(res) // "HELLO WORLD!"

Official guide: https://www.w3schools.com/jsref/jsref_touppercase.asp

like image 174
Rise Avatar answered May 18 '26 05:05

Rise



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!