Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

best method to convert string to upper case manually

function myToUpperCase(str) {
  var newStr = '';
  for (var i=0;i<str.length;i++) {
    var thisCharCode = str[i].charCodeAt(0);
    if ((thisCharCode>=97 && thisCharCode<=122)||(thisCharCode>=224 && thisCharCode<=255)) {
    	newStr += String.fromCharCode(thisCharCode - 32);
    } else {
    	newStr += str[i];
    }
  }
  return newStr;
}
console.log(myToUpperCase('helLo woRld!')); // => HELLO WORLD!
console.log(myToUpperCase('üñïçødê')); // => ÜÑÏÇØDÊ
Comment

PREVIOUS NEXT
Code Example
Javascript :: append array in array 
Javascript :: javaScript throw statement 
Javascript :: js windowresize event 
Javascript :: bot react message with custom emoji 
Javascript :: js repeat 
Javascript :: how to add a new line in template literal javascript 
Javascript :: jquery method 
Javascript :: remix js 
Javascript :: sign javascript 
Javascript :: props history 
Javascript :: express multer 
Javascript :: javascript for validation 
Javascript :: how to sort an array 
Javascript :: drag n drop file upload react 
Javascript :: ex:javascript 
Javascript :: break in javascript 
Javascript :: null check in javascript 
Javascript :: es6 import 
Javascript :: add event listeners 
Javascript :: express api 
Javascript :: jquery check if click to this self not this child 
Javascript :: mapsort 
Javascript :: html check template browser 
Javascript :: You are getting a `numbers` array. Return the sum of **negative** numbers only. //condition to check for negative 
Javascript :: sort datatable c# 
Javascript :: exemplo simples de socket com node 
Javascript :: iterate over all check box in a div 
Javascript :: how to delete an item on click in js 
Javascript :: chandrachaan 
Javascript :: progrmatically change audio src 
ADD CONTENT
Topic
Content
Source link
Name
4+4 =