While loop checking for capital letters in string
<p>I have a function which checks if a given character is capital letter and returns true of false value:</p>

<pre><code>function isUpperCase(aCharacter)
{
    return (aCharacter &gt;= 'A') &amp;&amp; (aCharacter &lt;= 'Z');
}
</code></pre>

<p>Now I have a string of characters e.g. <code>ThksAbcdEvat</code>. </p>

<p>I want to write a function which checks every character in a string and when it encounters a capital letter is will execute function <code>decryptW</code> but only on a block of letters until next capital letter.</p>

<p>Function decryptW works fine on single words. So what im looking for is execution of function 'decryptW' on 'Thks' 'Abcd' 'Evat' and return 3 words as a result. all i have at the moment is:</p>

<pre><code>function decryptMessage(cipherText, indexCharacter, plainAlphabet, cipherAlphabet)
{
    for (var count = 0, count &lt; cipherText.length; count++)
    {
        while (isUpperCase(cipherText.charAt(count))
        {
            if (count - lastCapital &gt; 1)
            {
                decryptWord(cipherText, indexCharacter, plainAlphabet, cipherAlphabet);
                lastCapital = count;
            }
        }
    }
}
</code></pre>

<p>Can you tell me if I'm even close to what I want to achieve? Any help would be much appreciated. </p>
