playMaker

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

westingtyler

  • Sr. Member
  • ****
  • Posts: 277
    • My Video Game Projects Web Site
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 14, 2016, 02:58:35 AM by jeanfabre »

terri

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

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: "get all of left side of a string up to a certain character type"
« Reply #2 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

terri

  • Sr. Member
  • ****
  • Posts: 386
    • terrivellmann.tumblr.com
Re: "get all of left side of a string up to a certain character type"
« Reply #3 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

westingtyler

  • Sr. Member
  • ****
  • Posts: 277
    • My Video Game Projects Web Site
Re: "get all of left side of a string up to a certain character type"
« Reply #4 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.