Loop through each char of string

Hi @satyam_verma

I have attached a workflow using array of string loop.

1.xaml (8.4 KB)

Hope it helps!!
Regards

Hi @satyam_verma
TestString is a variable type of string
CharArray is a variable type of Array of string

Hope it helps!!

i want to remove all vowel of even place from “I am learning Ui path” and leave as it is if there is space
Please help me

Hi,

Can you share expected output for the above?

Regards,

I am learning Ui Path
m larnng i pth >>>>that’s output

with Regards,

currently, there is a difference to your output, but we guess this is about expectations and description

EDIT: Sample is only half implemented
grafik

1 Like

could you please explain it With activity
if you please don’t mind

Create an array of capital and small case Vowels → Use a for each activity → for each item in Input_String → use if else activity inside for each activity-> if item in array then Input_String.replace(item, “”) else continue

Please reply on this if you need excess details regarding the same.

1 Like

Hi,

Can you try the following?

yourString = "I am learning Ui Path"
arrVowel = {"a","i","u","e","o"}

Then

String.Join("",yourString.Where(Function(c,i) i mod 2 =1 OrELse not arrVowel.Contains(c.ToString.ToLower)))

img20230629-1

Regards,

1 Like

could you please explain after for each activity in details

we had a different output as the sample string had a space between ui and path

0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
I a m l e a r n i n g U i P a t h

strText = “I am learning Ui path”

Assign Activity
arrVouwels | String Array = new String(){"A","E","I","O","U"}

Assign Acitvity

newString =  String.Join("",strText.Select(Function (x,i) If(i mod 2 = 0 AndAlso arrVowels.contains(x.toString.ToUpper), "", x.toString)))

Hello sir
I am getting blank output after this

Regards,

what was done in detail?


I am uploading the image please check this

we cannot see the used detail statement But in general the modelling looks fine.

Just do the prototyping also in within the immediate panel and use the debugging panels for the analysis:
Understanding the 6 Debugging Panels of UiPath in the easiest way possible! - News / Tutorials - UiPath Community Forum

1 Like

Hi,

You should output not newstr but newstring.

image

Regards,

2 Likes

Thankyou so much for all your help sir
really thankyou
people like you make this platform alive.

Thanks for being sir
really appreciate you help

Take an if-else activity → if Input_String.indexof(item) mod 2 = 0 and item in array then Input_String.replace(item,“”) → else continue

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