/home/caleb/ASDV-Java/Exams/PracticeExam2/src/practiceexam2/CharsToUnicodeWhile.java |
nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt
nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java
package practiceexam2;
import java.util.Scanner;
@author
public class CharsToUnicodeWhile {
public static void main(String[] args)
{
String toUnicode = "";
Scanner input = new Scanner(System.in);
while (!toUnicode.toLowerCase().equals("q")) {
System.out.print("Enter a string of characters to convert them to UNICODE or Q/q to quit this program: ");
toUnicode = input.next();
if (toUnicode.toLowerCase().equals("q")) {
break;
}
System.out.print(toUnicode + " in UNICODE is: ");
for (int x = 0; x < toUnicode.length(); x++) {
System.out.print(((int) toUnicode.charAt(x)) + " ");
}
System.out.println();
}
System.out.println("Goodbye!");
}
}