cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Responsive Resident
Responsive Resident

String Manipulation

Hello everyone,

 

i am trying to cut off some text from a text label, this text label produces a "string type" number sequence. 

 

for example it will produce a 30-02-03, how can i cut off "-02" that way 30-03 is left. 

 

what i am trying to do:

i am trying to create a custom id for each item that gets created with follow up requests that link, for example, a frist go through of a request will be 30-01, second request will be a follow up so 30-02, then 30-03 and so on, 

 

thanks !

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Support
Community Support

Re: String Manipulation

Hi @mmattar,

Do you want to cut off the "-02" from the "30-02-03" text string value?

Based on the needs that you mentioned, I think the Split function and Concatenate function could achieve your needs.

I have made a test on my side, please take a try with the following workaround:4.JPG

Set the Text property of the Label control to following:

Concatenate(
First(Split(Label1.Text,"-")).Result, /* retrieve 30 */
"-",
Last(Split(Label1.Text,"-")).Result /* retrieve 03 */
)

More details about the Split function and Concatenate function in PowerApps, please check the following article:

Split function

Concatenate function

 

Best regards,

Kris

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
Highlighted
Resolver I
Resolver I

Re: String Manipulation

Using a combination of the Left and Right functions will likely get you what you are looking for by the sounds of it.

 

Label1.Text = "30-02-03"

Label2.Text = Left(Label1.Text,2) & Right(Label1.Text,3)

This results in "30-03" in Label2

 

Hope this helps.

Highlighted
Community Support
Community Support

Re: String Manipulation

Hi @mmattar,

Do you want to cut off the "-02" from the "30-02-03" text string value?

Based on the needs that you mentioned, I think the Split function and Concatenate function could achieve your needs.

I have made a test on my side, please take a try with the following workaround:4.JPG

Set the Text property of the Label control to following:

Concatenate(
First(Split(Label1.Text,"-")).Result, /* retrieve 30 */
"-",
Last(Split(Label1.Text,"-")).Result /* retrieve 03 */
)

More details about the Split function and Concatenate function in PowerApps, please check the following article:

Split function

Concatenate function

 

Best regards,

Kris

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Highlighted
Solution Sage
Solution Sage

Re: String Manipulation

In case it is not obvious, @KLatch's solution is quick and gets the job done assuming you always have 2 digit first and last components to your numbering.

 

@v-xida-msft's solution is forward scalable to any length of text delineated by the hyphen... assuming you always have a hyphen.

 

If you have cases that would break those assumptions, post back with fuller rules of generating your initial data.

Highlighted
Post Prodigy
Post Prodigy

Re: String Manipulation

Hi @v-xida-msft 

What should i do if i want to get these text separated into 3 part? (separated with number inside the bracket) and put it into a different label.

 

I need to split it into 3 part based on the (01), (17), and (10)I need to split it into 3 part based on the (01), (17), and (10)
I also want to take the middle part, which is 220228.

 

I already try with split function for the container label in label.text property:
Split(Label1.Text, "(10)").Result  but it return error with error message: Expecting text value.

 

Can you help me achieve these?

Thanks,
pytbyt

Helpful resources

Announcements
secondImage

Demo-Extravaganza 2020

Check out these cool Power Apps & vote on your favorite!

secondImage

Community Highlights

Check out whats happening in Power Apps

secondImage

Community User Group Member Badges

FIll out a quick form to claim your community user group member badge today!

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (12,203)