Programming Questions

  • Newest
  • Popular Tags
  • Ask A Question
  • Letter Changes - How to ignore white spaces?
    How do I ignore white spaces?
    function LetterChanges(str) { 
        var results = "", vowels = "aeiou", capitalized = "", char = "", znZ = "";
        
        znZ = str.replace(/z|Z/gi, function(i){
           return "a"; 
        });
        
        znZ.replace(/[a-z]/gi, function(i){
          return  results += String.fromCharCode(i.charCodeAt() + 1);
        });
    
        capitalized = results.replace(/a|e|i|i|u/gi, function(i){
          return i.toUpperCase();
        });
      
        return capitalized;
    }
    
    LetterChanges("code by");
    pakchu posted this question on 4/20/16 | javascript, letter, changes
    Answers
  • +
  • 4
  • -
  • \s - any whitespace or \S - any non-whitespace character. The other idea how to do this task - think of using str.split() to work with words or characters instead of working with the original string.
  • +
  • 0
  • -
  • my answer for exercise "letter capitalize"
  • +
  • 0
  • -
  • try to use str.title() to solve this exercise
    return str.title()
    
    Log in to write an answer.