Frage

here's my code:

    for(int i=0; i<plainTextUpper.length()-1; i++)
    {
      System.out.println(charCodeAt(i));
    }

It won't compile though, because it says charCodeAt's symbol was not found. Am I missing a library? The only one I have imported right now is java.util.*

War es hilfreich?

Lösung

Assuming that this is Java and not Javascript, you probably want this:

for(int i=0; i<plainTextUpper.length()-1; i++)
{
    System.out.println(plainTextupper.codePointAt(i));
}

Note that this will not process the last character of plainTextUpper. You probably also want to either get rid of the -1 or change the comparison operator to <= in the for termination test.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top