How to remove the vowel from the even index

Hi All,

I have a string i.e “I am learning the automation tool”

From above string I need to delete the vowel which are present in even index(like 0,2,4,6 etc)
if there is space at even index then need to ignore it.

so the final output will be: " m larning the atmton tol"

Please guide me how to do this??

@ppr
@ushu
@Gokul001
@Yoichi
@vishal.kp

Quick Dirty (without if there is space at even index then need to ignore it.):

So we would recommend to evolve to

strValue = “YourString”
arrChar =
(From i in Enumerable.Range(0, strValue)
// More Conditions
// Char calculations
Select …).toArray

strNew = newString(arrChar)

@Vrishchik

Please try this

String.Join("","I am learning the automation tool".Where(function(x,i) not (i mod 2).Equals(0) OrElse not {"a","e","i","o","u"}.contains(x.ToString.Tolower)))

cheers

Hi @Vrishchik ,

you can use the below logic

counter = 0;
currentString=“I am learning the automation tool”
newString = “”;
while counter < current.length
if counter%2 == 0 and currentString.charAt(counter) not in (‘a’,‘e’,‘i’,‘o’,‘u’)
newString=newString+currentString.charAt(counter)
else
newString=newString+currentString.charAt(counter)
counter=counter+1

String.Join(“”, var.Where(Function(c, i) Not “aeiouAEIOU”.Contains(c) Or i Mod 2 <> 0 Or c = " "c))
Where var is an input string you assign ex:var=“Hello World”

Regards

there is maybe a missmatch between description and sample output

grafik

we do see uto vs ato

and maybe this rule:

is maybe to clear as it would change the indexes after its occurrence

Hi @Vrishchik

  1. Use below condition in assign activity:
inputString="I am learning the automation tool"
resultString=""
  1. Use for Each activity to iterate through inputString.
  2. Use Assign activity and give below condition.
currentIndex= inputString.IndexOf(currentItem.ToString) 

Note Data Type of currentIndex is System.Int32
4. Use If activity and give the below condition:

"AEIOUaeiou".Contains(currentItem.ToString) And currentIndex Mod 2 = 0
Then
        Use Continue activity
  1. Use Assign activity and give below condition:
resultString= resultString+currentItem.ToString
  1. Print resultString in log message.

Please find the below workflow file. Hope it help you.

Sequence4.xaml (9.5 KB)

Hope it works!!

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.