# determine a letter is vowel

Page 1 of 1

## 6 Replies - 295 Views - Last Post: 04 February 2018 - 02:22 PMRate Topic: //<![CDATA[ rating = new ipb.rating( 'topic_rate_', { url: 'http://www.dreamincode.net/forums/index.php?app=forums&module=ajax&section=topics&do=rateTopic&t=409107&amp;s=bc38a5ef93cbf2936322366b3175e731&md5check=' + ipb.vars['secure_hash'], cur_rating: 0, rated: 0, allow_rate: 0, multi_rate: 1, show_rate_text: true } ); //]]>

### #1 Xhertus

Reputation: 0
• Posts: 18
• Joined: 03-February 18

# determine a letter is vowel

Posted 04 February 2018 - 05:09 AM

```public String doubleVowel(String str)
{
String result ="";
String vowels= "a" && "e" && "i" && "o" && "u";
for(int i =0; i < str.length(); i++)
{
result+ = vowels;
}
}

```

Hello, dear members. I have been working on a method which provides me to double all vowels in a string. I am new at coding and also on this forum. I thought something like that but it seems totally wrong to me. I am thinking about adding a private boolean to determine a letter is boolean or not.
Waiting for advices and some help.

Is This A Good Question/Topic? 0

## Replies To: determine a letter is vowel

### #2 NormR

• D.I.C Lover

Reputation: 674
• Posts: 5,087
• Joined: 25-December 13

## Re: determine a letter is vowel

Posted 04 February 2018 - 05:27 AM

Quote

private boolean to determine a letter is boolean or not

Can you explain what that means? A value like a letter is not a boolean.
A boolean value is either true or false. A boolean value can represent a condition like a is greater than b or a is contained in abc.

When writing a program you need to have a design for it before deciding what statements to use to implement the design.
What are the steps the code needs to do to solve your problem?
When you have those steps listed, then work on the statements that are needed.

### #3 Xhertus

Reputation: 0
• Posts: 18
• Joined: 03-February 18

## Re: determine a letter is vowel

Posted 04 February 2018 - 05:28 AM

Ov sorry.. I mean to determine a letter is vowel or not my mistake

### #4 NormR

• D.I.C Lover

Reputation: 674
• Posts: 5,087
• Joined: 25-December 13

## Re: determine a letter is vowel

Posted 04 February 2018 - 05:32 AM

Can you list the steps the method must take to solve the problem?
You need to have that list of steps before trying to write code.

### #5 Thomas1965

• D.I.C Regular

Reputation: 88
• Posts: 339
• Joined: 09-September 16

## Re: determine a letter is vowel

Posted 04 February 2018 - 06:23 AM

One easy way to do it is to create a string with all vowels in uppercase and lowercase.
To determine if a character is a vowel you check if the indexOf method of the string returns != -1

### #6 g00se

• D.I.C Lover

Reputation: 3515
• Posts: 15,905
• Joined: 20-September 08

## Re: determine a letter is vowel

Posted 04 February 2018 - 08:18 AM

Quote

I have been working on a method which provides me to double all vowels in a string.

You could try something like
```s = s.replaceAll("(?i)([aeiou])", "\$1\$1");
```

### #7 andrewsw

• blow up my boots

Reputation: 6521
• Posts: 26,397
• Joined: 12-December 12

## Re: determine a letter is vowel

Posted 04 February 2018 - 02:22 PM

Do not use a meaningless title, "Help about code..", I have changed it for you on this occasion.