How to know the index of a string in a splitted text

Hello,

I had splitted a text from an interface, splitted it with Split(Environement.NewLine.tochararray). the result is liste of item.
i want to count the index of a specefic ligne in the splitted text.

@abdel,

You want to know index of the particular string or line ?

a particular line

@abdel,

Try below one:

for (m = 0; m < item.Count(); m++)
    {
        if (item[m].Contains(TextToLookUp))
        {
            break;
        }
    }
    return m++;

Here, item is array of string (splitter text)

Thereis nous for activité on uipath, thereis are for each only,

@abdel,

Use while loop

  1. assign m=0
  2. while loop m < item.count()
    If item(m). contains (textTolookup)
    Break
    End If
    Assign m = m+1
    End loop
    Linenumber = m

thank you Iakshman, the break activity does not exist fr while loop in uipath

@abdel,

Here, that break activity is for IF but not for while loop.

there is no break for if activity? here is the codeChercher la pièce correspondante au numéro de compostage dans Prolog (paginer si nécessaire en cliquant sur F8).xaml (36.6 KB)

hello, if i had a string like: “MOTIV DO LIKE THIS____”

how to extract DO LIKE THIS only

Hi @abdel
You can use Split with " " delimiter as given below:
Text = str2.Split({" "}, StringSplitOptions.None)(1) - - > to get Do
Use the same to get LIKE and THIS by only changing index
LIKE - - > (2)
THIS - - > (3)
Concatenate those 3 variables with " ".
That’s it.