Vrishchik
(Naveenkumar Shivaraju)
August 2, 2023, 9:49am
1
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
ppr
(Peter Preuss)
August 2, 2023, 10:01am
2
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)
Anil_G
(Anil Gorthi)
August 2, 2023, 10:04am
3
@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
Sharath_HK
(Sharath Keshavamurthy)
August 2, 2023, 10:04am
4
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
ppr
(Peter Preuss)
August 2, 2023, 10:20am
6
there is maybe a missmatch between description and sample output
we do see uto vs ato
and maybe this rule:
is maybe to clear as it would change the indexes after its occurrence
Parvathy
(PS Parvathy)
August 2, 2023, 10:29am
7
Hi @Vrishchik
Use below condition in assign activity:
inputString="I am learning the automation tool"
resultString=""
Use for Each activity to iterate through inputString.
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
Use Assign activity and give below condition:
resultString= resultString+currentItem.ToString
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
system
(system)
Closed
August 5, 2023, 10:30am
8
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.