Playmaker Forum

PlayMaker Feedback => Action Requests => Topic started by: westingtyler on October 13, 2016, 02:00:56 AM

Title: "get all of left side of a string up to a certain character type"[SOLVED]
Post by: westingtyler on October 13, 2016, 02:00:56 AM
basically, I want to break up a string that has a bunch of commas in it.

ie:

product a is apple, product be is grape, fuel type is biscuits, fuel needed is 15

I want an action to store everything up to the first comma as one string, getting rid of blank space at the beginning IF it exists.

then I can subtract this new length from the total, get string right of the original, and repeat until I have all the pieces I need.
Title: Re: "get all of left side of a string up to a certain character type"
Post by: terri on October 13, 2016, 04:47:28 AM
Use the action String Split 2 String Split
Title: Re: "get all of left side of a string up to a certain character type"
Post by: jeanfabre on October 13, 2016, 06:53:09 AM
Hi,

Where do you get StringSplit2? I checked the ecosystem it's not there.

so indeed:

- Use StringSplit ( or any varients) action for this. you'll get an array of all your entries, and then you can scan them using index.

- check "Trim Strings" to remove trailing white spaces.

I started on a csv parser anyway, I think it's a good addition to DataMaker. We'll hopefully publish it in few days.

 Bye,

 Jean
Title: Re: "get all of left side of a string up to a certain character type"
Post by: terri on October 13, 2016, 09:14:45 AM
oops, my bad, I think I made myself a custom version and added a 2 to the default one
Title: Re: "get all of left side of a string up to a certain character type"
Post by: westingtyler on October 14, 2016, 02:55:13 AM
thanks, guys. i made this function myself out of other actions for a machine yesterday, but now I get to use this single action, which will be a huge time saver for new machines. i'm building an 'item well' (soda machine, water condenser, etc.) and storing the well stats in an EZSave2 text file, then grabbing those stats from a long string using this method.