How to replace last characters in string?

I have a url like ‘abcd&page=0’. The last number changes dynamically. I have to replace the last number with a ‘counter’ value. How do I do this?


you can use variable to store the dynamic value and concatenate to url like…


the above url is stored in a variable say “url”. Also page= could be one or two digit.

Hey @shrutika,
Try this…
url = ‘abcd&page=“+counter.tostring+”’

Let me know if any issue…

Best Regards,

Hi @shrutika

You could use split method for your url string, like this:

It would give you the output you want:

See attached xaml file for reference:
LastCharacter.xaml (6.1 KB)

Say your variable is like
url = "abcd&page=[counter]"

You can use
url.Replace("[counter]", counterNo.ToString)

where counterNo can be your integer variable for the last digits.

Thank you. I have other query. I have a string like MyString= “

<href=‘’>ABC Corp
”. I need only the middle content and remove everything in between <>. I have used MyString.Replace(“<*>”,“”). But this doesnt seem to work. Please help

Forum removes the html tags, but you can post them using the code snipped tag:

If you want to get ABC Corp from, for example:
<a href=‘’>ABC Corp</a>
you could use this Regex expression:

You can use it like this:

This should return a string with just ABC Corp :slight_smile:

I was able to it with this:

I have a url like: myURL=“’”. I need to remove only the last ‘overview/’ so that the output will be myURL="’. I have used myURL.Replace but it replaces both the instances. How do I achieve this?

@shrutika ,
Use lastindex() method and pass ‘overview’ as parameter. With this , you’ll get an index position and now do a substring using that index