Hey guys, I’m running a shell script and it returns a short string like “Credit: nnnnnn:nnnn” where n are numerical values.
I would like to parse out the numbers from the "Credit: " part and do something based on the value. Can’t seem to find a way to parse a simple string like that.
Any help would be great. Thanks!
Nevermind! Just used “delete” to parse it out. Had to dig a little hah.
Here’s how I would approach this. If you simply want to lop off the "Credit: " part, you can do this:
delete all "Credit: " from output_var
If you need to split the two numbers apart you can then split them into a list like this:
put output_var split by ":" into numbers_list --this outputs a list
There’s a whole section of the docu on text processing. Check out Working with Text in the SenseTalk Reference section of the docu for more fun ways to play around with this.
Hope this helps!