--- warning: This file is auto generated by `yarn web:inject`, do not edit by hand examples: - upcase('hello') - upcase('Hello World') returns: - '''HELLO''' - '''HELLO WORLD''' dependencies: [] authors: original by: - Kevin van Zonneveld (https://kvz.io) notes: [] parityVerified: - Elixir 1.18 isTypescript: true type: function layout: function title: Elixir's String.upcase in TypeScript description: >- Here's what our current TypeScript equivalent to Elixir's String.upcase looks like. function: upcase category: String language: elixir permalink: elixir/String/upcase/ alias: - /functions/elixir/upcase/ - /functions/String/upcase/ - /elixir/upcase/ ---
{% codeblock lang:typescript %}export function upcase(string: string): string { // discuss at: https://locutus.io/elixir/upcase/ // parity verified: Elixir 1.18 // original by: Kevin van Zonneveld (https://kvz.io) // example 1: upcase('hello') // returns 1: 'HELLO' // example 2: upcase('Hello World') // returns 2: 'HELLO WORLD' return String(string).toUpperCase() } {% endcodeblock %}