program checking string of characters for capital letters

Ok, i have a function which checks if a letter is upper case and returns 'true' or 'false' value. function isUpperCase(aCharacter) { return (aCharacter >= 'A') && (aCharacter <= 'Z'); } now I would like it to check a string of characters e.g. 'AdfdfZklfksPaabcWsgdf' and after the program encounters capital letter it will execute function decryptWord on all small letters after this letter and until next capital letter and so on. Function decryptWord works fine on single words i just cant get it work on more than one ;( function decryptMessage(cipherText, indexCharacter, plainAlphabet, cipherAlphabet) { for (var count = 0, count < cipherText.length; count++) { if (isUpperCase(cipherText.charAt(count))) { decryptWord(cipherText, indexCharacter, plainAlphabet, cipherAlphabet) } else { //i dont know what to do next } } } can you tell me if i'm going in the right direction?
I'm not certain if this is actually relevant to your problem, but you've a syntax error in your code. Change that , in your for loop's parentheses to a ;.

以上就是program checking string of characters for capital letters的详细内容,更多请关注web前端其它相关文章!

赞(0) 打赏
未经允许不得转载:web前端首页 » JavaScript 答疑

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

前端开发相关广告投放 更专业 更精准