looking for string manipulation documentation

can’t find any info on a whole series of functions, like ss, ssc, etc. etc.

anyone can post any info about them? right this moment I need to easily pop words from the end of a string (maybe one of those functions can help avoid ugly substr/strlen/argc/arg formulas…)

In case they don’t, wouldn’t be nice to have a argm (multiple arguments) like: argm(“$mystring”,0,argc(“$mystring”)-1) ?

d

Have you checked argx? That might do it for you.

From exhelp:

cheers
markus

you can forget about the ss* expressions. I think these are leftovers from the days when tables were called spreadsheets. Just use the tab family.

no argx is also severly limited when it comes to splicing a string.

ie. I have

item1 item2 item3 item4 item5 item6

I need to pop item6 from the end, currently I have to type something like:

substr($s,0,strlen($s)-strlen(arg($s,argc($s)-1)))

and that’s the easy task! if I need to splice out and replace item3 with itemwhatever, then that’s when it gets waaay too complex for an operation that should be simple.

I’ll write a script to do it, but it sure would be nice to have that argm and - since you’re at it - an argmx function (that works with separators other than " ")

ie. popping:
argm($s,0,argc($c)-2)

ie. splicing:
argm($s,0,$itemtoreplace-1) + “newstring” + argm($s,$itemtoreplace),argc($s)

something like that. A lot more readable.

d

totally agree that this would be nice. Until then you could also make use of the substitute expression in case you don’t have double entries in your list.
That would allow popping and splicing without too much complexity.

popping

set list = item1 item2 item3 item4 item5 item6
set partial = `substitute("$list",argx("$list",argxc("$list"," ")-1," "),"")`

splicing

set list = item1 item2 item3 item4 item5 item6
set partial = `substitute("$list",argx("$list",2," "),"item30")`

cheers
markus

I’ve been using tables more often recently for manipulating chunks of strings.

Yeah, I talked to dani about this approach too. It is easy to do some operations on lists when they are thrown into a single column table. It is easy to remove rows or splice in rows by name or index using the tab() expression and the table command.