cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Advocate I
Advocate I

Convert String characters to a collection

Hi,

 

I'm trying to take a string and add each of it's characters to a collection.  

 

So for string

TEST STRING

 

I would populate a collection with

Record 1 - T

Record 2 - E

Record 3 - S

etc.

 

Any ideas?

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User II
Super User II

Hi!

 

Have you considered using the Split() function, this will split the text into single characters if you use the separator of "" rather than an actual text value.

ClearCollect(ThisCollection, Split(TextToSeparate, "") );

 

Could you give that a try and let me know if you run into any issues?

 

Thanks,

Sancho


@iAm_ManCat

Please 'Mark as Solution' if someone's post answered your question and always 'Thumbs Up' the posts you like or that helped you!


Thanks!
You and everyone else in the community make it the awesome and welcoming place it is, keep your questions coming and make sure to 'like' anything that makes you 'Appy
Sancho Harker, MVP


View solution in original post

3 REPLIES 3
Highlighted
Super User II
Super User II

Hi!

 

Have you considered using the Split() function, this will split the text into single characters if you use the separator of "" rather than an actual text value.

ClearCollect(ThisCollection, Split(TextToSeparate, "") );

 

Could you give that a try and let me know if you run into any issues?

 

Thanks,

Sancho


@iAm_ManCat

Please 'Mark as Solution' if someone's post answered your question and always 'Thumbs Up' the posts you like or that helped you!


Thanks!
You and everyone else in the community make it the awesome and welcoming place it is, keep your questions coming and make sure to 'like' anything that makes you 'Appy
Sancho Harker, MVP


View solution in original post

Highlighted

Thanks @iAm_ManCat  - works perfectly.  I never thought of using Split with an empty string - though I did see in the Microsoft help Docs for Split.. 🤔😁

Highlighted

Glad I could help, I've had to use it again recently so it was fresh in my mind 😺

Hope you have a great day!


@iAm_ManCat

Please 'Mark as Solution' if someone's post answered your question and always 'Thumbs Up' the posts you like or that helped you!


Thanks!
You and everyone else in the community make it the awesome and welcoming place it is, keep your questions coming and make sure to 'like' anything that makes you 'Appy
Sancho Harker, MVP


Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Community Highlights

Community Highlights

Check out the Power Platform Community Highlights

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