How can I get text after certain string of word...can anyone help in this regard

How can I get string after certain word?
example:“Welcome to World”
From Above i want to get string After Welcome…means how can i use “string after” function in this regard to get result as “to word”

1.Welcome to World --------- ans: “to World”
2.Welcome to Home -------- ans:“to Home”
3.Hello!,Welcome to Company ----- ans:“to Company”
can anyone help me in this regard?

You can use substring function to get the output.

Consider, strSource = “Welcome to World”
findStr = “Welcome”

if (strSource.Contains(findStr))
    {
        Start = strSource.IndexOf(findStr) + findStr.Length;        
        output = strSource.Substring(Start);
     }

Regards,
Karthik Byggari

Iam new to UIPATH…How can i Execute this?

Drag Invoke Code activity and paste the code

Dim str As String = “Welcome to World”
Dim findstr As String = “Welcome”
If str.Contains(findstr) = True Then
Dim str1 As String = CStr(str.IndexOf(findstr) + findstr.Length)
Dim output As String = str.Substring(CInt(str1))
End If

if you want to pass the string dynamically,you can use edit arguments to pass variable value changng the code as

Dim str As String = your variable

1 Like

Create four variables in your workflow,

Name, Datatype, Default
strSource, String, “Welcome to World”
findStr, String, “Welcome”
strOutput, String,
Start, Integer,

In if activity, add the following condition

If strSource.Contains(findStr)

Then

Assign Activity, Start = strSource.IndexOf(findStr) + findStr.Length
Assign Activity, strOutput = strSource.Substring(Start)
Message Box Activity, strOutput

3 Likes

can u provide UIPATH file for this…with output…please…

TANQ KARTHIK for your help

Main.xaml (5.3 KB)

Provide the input when it prompted .
Example : Welcome to UiPath.

**Note : No need of Quotations(")

1 Like

tanq very much @HareeshMR:slightly_smiling_face:

i want to get output out of invoke code activity,can u help in this regard

Hi,

Main.xaml (5.7 KB)

Here is the file

so much tanq for your kindly help,it will help me for clear understanding…

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