cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
yeahILuvPP
Advocate II
Advocate II

replace last part of string

Hi 

 

I am trying to replace last part of the string, after the last "_"

My example

base text: test_test_test_1

new text should be: test_test_test_NewText

 

How can I accomplish this?

1 ACCEPTED SOLUTION

Accepted Solutions

There may be better way of doing this, but  came up with:

Concatenate(Left(TextInput4.Text,Find("#",Substitute(TextInput4.Text,"_","#",
Len(TextInput4.Text)-Len(Substitute(TextInput4.Text,"_",""))))-0),"Image")


or


Concatenate(Left(TextInput4.Text,Find("#",Substitute(TextInput4.Text,"_","#",
Len(TextInput4.Text)-Len(Substitute(TextInput4.Text,"_",""))))-0),TextInput6.Text)

------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

View solution in original post

4 REPLIES 4
eka24
Super User
Super User

Assuming the test_test_test_1 is in TextInput4, in default of Textbox5:

Substitute(TextInput4.Text,"_1","_NewText")

------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

"_" is static. The "1" in my example is always a dynamic value.. it could be _test1, _test5, _testX

 

After the last "_" I want to replace the text with e.g. "Image".

There may be better way of doing this, but  came up with:

Concatenate(Left(TextInput4.Text,Find("#",Substitute(TextInput4.Text,"_","#",
Len(TextInput4.Text)-Len(Substitute(TextInput4.Text,"_",""))))-0),"Image")


or


Concatenate(Left(TextInput4.Text,Find("#",Substitute(TextInput4.Text,"_","#",
Len(TextInput4.Text)-Len(Substitute(TextInput4.Text,"_",""))))-0),TextInput6.Text)

------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

yeahILuvPP
Advocate II
Advocate II

Thanks!!! It works like a charm!

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Users online (4,763)