AppDividend
Latest Code Tutorials

Javascript String toLocaleLowerCase() Tutorial With Example

0

Javascript String toLocaleLowerCase() Tutorial With Example is today’s topic. The toLocaleLowerCase() method converts a string to lowercase letters, according to the host’s current locale.

For most languages, it returns the same outcome as toLowerCase function. The toLocaleLowerCase() method returns a calling string value converted to the lower case, according to any locale-specific case mappings.

Javascript String toLocaleLowerCase() Tutorial

The locale is based on the language settings of the browser. The toLocaleLowerCase() method returns the same result as the toLowerCase() method. However, for some locales, where language conflict with the regular Unicode case mappings occurs (such as Turkish), the results may vary. Javascript toLocaleLowerCase() method does not change the original string.

#Syntax

The syntax of string toLowerCase() function is following.

string.toLocaleLowerCase(locale)

The locale parameter indicates a locale to be used to convert to the lower case according to any locale-specific case mappings. If the multiple locales are given in the Array, the best available locale is used.

The toLocaleLowerCase function returns the String, representing the value of a string converted to lowercase according to the host’s current locale.

See the following example.

// app.js

let dottedData = 'Türkçe';
console.log('EN-US: ' + dottedData.toLocaleLowerCase('en-US'));
console.log('TR: ' + dottedData.toLocaleLowerCase('tr'));

See the following output.

Javascript String toLocaleLowerCase() Tutorial

 

See other examples.

console.log('KRUNAL'.toLocaleLowerCase());
console.log('\u0130'.toLocaleLowerCase('tr') === 'i');
console.log('\u0130'.toLocaleLowerCase('en-US') === 'i');
let locales = ['tr', 'TR', 'tr-TR', 'tr-u-co-search', 'tr-x-turkish'];
console.log('\u0130'.toLocaleLowerCase(locales) === 'i');

See the following output.

String toLocaleLowerCase()

 

Finally, Javascript String toLocaleLowerCase() Tutorial With Example is over.

Leave A Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.