playMaker

Author Topic: "get all of left side of a string up to a certain character type"[SOLVED]  (Read 579 times)

westingtyler

  • Full Member
  • ***
  • Posts: 125
    • View Profile
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.
« Last Edit: October 13, 2016, 11:58:35 PM by jeanfabre »

terri

  • Sr. Member
  • ****
  • Posts: 348
    • View Profile
    • terrivellmann.tumblr.com
Re: "get all of left side of a string up to a certain character type"
« Reply #1 on: October 13, 2016, 01:47:28 AM »
Use the action String Split 2 String Split
« Last Edit: October 13, 2016, 06:15:27 AM by terri »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 12342
  • Official Playmaker Support
    • View Profile
Re: "get all of left side of a string up to a certain character type"
« Reply #2 on: October 13, 2016, 03: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

terri

  • Sr. Member
  • ****
  • Posts: 348
    • View Profile
    • terrivellmann.tumblr.com
Re: "get all of left side of a string up to a certain character type"
« Reply #3 on: October 13, 2016, 06:14:45 AM »
oops, my bad, I think I made myself a custom version and added a 2 to the default one

westingtyler

  • Full Member
  • ***
  • Posts: 125
    • View Profile
Re: "get all of left side of a string up to a certain character type"
« Reply #4 on: October 13, 2016, 11:55:13 PM »
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.