Substring based on delimiter

Hi,

I wanted to get the substring based on some delimiter. For example:

Example 1-
Input: www.titan.co.in>shop>watches
Output: www.titan.co.in

Example 2-
Input: www.titan.co.in
output: titan

In example1, we can use the delimiter as “>”
In example2, we can use the delimiter as “.”

We didn’t have the fixed numbers of characters here, as the site name may vary.
So how should I write in my assign activity, to get such output?

Please help with this.
Thanks

If you have a string MyStr, you can get the first element based on a delimiter like this:

MyStr.Split(">"c)(0).

This will return “www.titan.co.in” in the first example. You would only need to change this to: MyStr.Split("."c)(1) for the second example.

But if you want to perform both operations in one line, you can use this:

MyStr.Split(">"c)(0).Split("."c)(1), which returns “titan” if MyStr is “www.titan.co.in>shop>watches”.

1 Like

Thank you so much.

Hi,
Need one more help,
Input: PC Jeweller/Customer service1800 120 1434Click on the errorNo errors? Give general feedback.Feedback
Output: 1800 120 1434

Input: Featured snippet from the web1800-266-0123You need to call the customer care on 1800-266-0123 or email us at customercare@titan.co.in to cancel your order
Output: 1800-266-0123

It means I am having a link, and I need to get only the contact details from that.
In short, I need the value between first integer value till the next character come, the number between them.
Can you help with this.

Thanks

1 Like

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