Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

Modify String with Uppercase

function myReplace(str, before, after) {
  if (before[0] === before[0].toUpperCase()) {
    after = after.replace(after[0], after[0].toUpperCase());
  }
  return str.replace(before, after);
}
Comment

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 :: convert string to array js 
Javascript :: launch json file for rust 
Javascript :: How To Use Multiple Styles in REACT 
Javascript :: queryselector multiple attributes 
Javascript :: solidity payable 
Javascript :: crud with firestore 
Javascript :: what is js 
Javascript :: print console.log 
Javascript :: pre selected data-grid material-ui 
Javascript :: fetch in vue 3 
Javascript :: How to make a toggle button in Angularjs 
Javascript :: js quote 
Javascript :: javascript for...in loop 
Javascript :: javascript return function 
Javascript :: for loop vue object 
Javascript :: err handling express 
Javascript :: events jquery 
Javascript :: javascript continue with while Loop 
Javascript :: while loop javascript 
Javascript :: remove second last element from array javascript 
Javascript :: conver all array to object 
Javascript :: how to use axios filter 
Javascript :: setstate not updating state immediately 
Javascript :: what is cross browser testing 
Javascript :: pdf to image javascript 
Javascript :: how to remove first element of array in javascript 
Javascript :: what is palindrome 
Javascript :: download in react 
Javascript :: what is a node 
Javascript :: what is a closure in javascript 
ADD CONTENT
Topic
Content
Source link
Name
9+1 =