Java Converting the characters in a string array depending on whether or not its a vowel

The method takes in any name and tests whether a character is a vowel or consonant. If its a vowel, it makes the character uppercase, if its a consonant, it makes the character lowercase. Any thoughts? I dont know how to add

.toUpperCase

and

.toLowerCase

in the if else statements.

public static void parsing(String name)
{
    String temp = name0;

    int i = 0;
    for(i = 0; i < temp.length(); i++)
    {
        if(temp.charAt(i) == a || temp.charAt(i) == A ||
           temp.charAt(i) == e || temp.charAt(i) == E ||
           temp.charAt(i) == i || temp.charAt(i) == I ||
           temp.charAt(i) == o || temp.charAt(i) == O ||
           temp.charAt(i) == u || temp.charAt(i) == U)
        {
         System.out.print(temp.charAt(i).toUpperCase);
        }Obviously wrong but I dont know what to do.
            else
            {
            System.out.print(temp.charAt(i).toLowerCase);
            }Obviously wrong but I dont know what to do.     
    }   

View More Answer And Comment : Stackoverflow


Top Answer 1

String vowelsArray = aeiuo;
String constantsArray = uppercase constants;
int stringLength = name.length();
String givenNameCopy = name.ToString();
for(int i = 0; i < stringLength; i++){
if(vowelsArray.contains(givenNameCopyi))
   then uppercase
else if(constantsArray.contains(givenNameCopyi))
   then lowercase
else
    continue;

hope this helps.

Top Answer 2

String vowelsArray = aeiuo;
String constantsArray = uppercase constants;
int stringLength = name.length();
String givenNameCopy = name.ToString();
for(int i = 0; i < stringLength; i++){
if(vowelsArray.contains(givenNameCopyi))
   then uppercase
else if(constantsArray.contains(givenNameCopyi))
   then lowercase
else
    continue;

hope this helps.

Top Answer 3

String vowelsArray = aeiuo;
String constantsArray = uppercase constants;
int stringLength = name.length();
String givenNameCopy = name.ToString();
for(int i = 0; i < stringLength; i++){
if(vowelsArray.contains(givenNameCopyi))
   then uppercase
else if(constantsArray.contains(givenNameCopyi))
   then lowercase
else
    continue;

hope this helps.

Top Answer 4

String vowelsArray = aeiuo;
String constantsArray = uppercase constants;
int stringLength = name.length();
String givenNameCopy = name.ToString();
for(int i = 0; i < stringLength; i++){
if(vowelsArray.contains(givenNameCopyi))
   then uppercase
else if(constantsArray.contains(givenNameCopyi))
   then lowercase
else
    continue;

hope this helps.

Top Answer 5

String vowelsArray = aeiuo;
String constantsArray = uppercase constants;
int stringLength = name.length();
String givenNameCopy = name.ToString();
for(int i = 0; i < stringLength; i++){
if(vowelsArray.contains(givenNameCopyi))
   then uppercase
else if(constantsArray.contains(givenNameCopyi))
   then lowercase
else
    continue;

hope this helps.

View More Answer And Comment : Stackoverflow

Laravel where in query

How would I do this with Laravel? SELECT movie.title FROM movie WHERE movie.id IN (SELECT session.movie_id FROM session WHERE session.id = :id and date = :date) View More Answer And Comment [Read More...]

CSS/JS not loading. CSS/JS broken

I just recently restored a backup i had. And after the restoring i logged in to my admin panel and got an message that I need to "update my cache" . So i updated the cache and also flushed it. [Read More...]

Store websocket connection to redis

I'm using websocket-rack to build a chat application API. I would like to store the websocket connections (which ends up being an instance of Rack::WebSocket::Handler::Base::Connection) in redis, so [Read More...]