TypeScript String padEnd() method Last Updated : 19 Jul, 2024 Comments Improve Suggest changes Like Article Like Report The String.prototype.padEnd() method in TypeScript is used to pad the current string with another string (repeated, if needed) so that the resulting string reaches a given length. The padding is applied from the end (right side) of the current string. This method is useful for creating strings of uniform length by appending characters at the end.Syntax:string.padEnd(targetLength: number, padString?: string): stringParameters:targetLength: Here you have to pass the length you want the final string to be, after adding padding. padString(Optional): The characters used for padding. Defaults, to spaces (' ') if not specified. Return Value:Returns a new string of the specified targetLength with the padString applied at the end of the current string.Examples of TypeScript String padEnd() methodExample 1: Basic Implementation of padEnd()In this example, we will use the padEnd() method to add spaces at the end of a string until it reaches the specified length. JavaScript const str: string = "GeeksforGeeks"; const paddedStr: string = str.padEnd(20); console.log(`${paddedStr} ${paddedStr.length}`); Output:GeeksforGeeks 20Example 2: Adding Specific Padding CharactersIn this example, we will use the padEnd() method to pad the string with '0' characters until it reaches the specified length. JavaScript const str: string = "456"; const paddedStr: string = str.padEnd(6, '0'); console.log(`${paddedStr} ${paddedStr.length}`); Output:456000 6 Comment More infoAdvertise with us Next Article TypeScript String padEnd() method P pankajbind Follow Improve Article Tags : JavaScript Web Technologies TypeScript Similar Reads TypeScript String padStart() method The padStart() function in TypeScript adds characters to the start of a string, serving as the opposite of padEnd(). It is particularly useful for formatting text or aligning numbers.Syntaxstring.padStart(targetLength: number, padString?: string): stringParameters:targetLength: Here you have to pass 2 min read Typescript String trimEnd method The trimEnd method, introduced in ECMAScript 2019 (ES10), is designed to remove whitespace characters from the end of a string. These whitespace characters include spaces, tabs, and line breaks. Its primary purpose is to sanitize and normalize strings, especially user inputs or data fetched from ext 2 min read JavaScript String padEnd() Method The padEnd() method in JavaScript is used to pad a string with another string until it reaches the given length. The padding is applied from the right end of the string.Syntax:string.padEnd( targetLength, padString );Parameters: This method accepts two parameters as mentioned above and described bel 3 min read JavaScript String padStart() Method The padStart() method in JavaScript is used to pad a string with another string until it reaches the given length. The padding is applied from the left end of the string. Syntax:string.padStart(targetLength, padString)Parameters:This method accepts two parameters as mentioned above and described bel 3 min read Lodash _.padStart() Method Lodash _.padStart() method is used to pad a string with another string until it reaches the given length. The padding is applied from the left end of the string. Padding characters are truncated if they exceed the length. Syntax:_.padStart( [string = ''], [length = 0], [chars = ' '] );Parameters: st 1 min read Like