Working with strings

Anything that doesn't fit elsewhere.
Post Reply
MishaZ

Working with strings

Post by MishaZ »

I have been trying to work with strings -- mainly, use them for saving and organizing data into files. But I haven't been able to figure out a way to combine, add strings or use any other string functions, like strcat() in C or "&" in VB...

Can anyone help?
ted
Site Admin
Posts: 6384
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

use StringFunctions to manipulate strings

Post by ted »

Use the StringFunctions class to work with strings--see
http://www.neuron.yale.edu/neuron/stati ... trfun.html

"Imagine an alternate universe in which all life forms are computer programs. What
controversy would result if a copy of NEURON fell into the hands of local philosophers!
'Definitely shows signs of Intelligent Design,' assert the members of one school of
sapient subroutines.
Their opponents counter: 'Bah. It's all evolutionary accident. Look at these layers upon
layers of oddities. Doubles, strdefs, sections, objrefs, hoc and NMODL--how could
all that chaos possibly result from anything other than the accidental collision and
recombination of loosely articulated blocks of code over the eons?'"
But still it works.
mjb7

Can you concatenate strings with StringFunctions?

Post by mjb7 »

I may be missing something, but I looked at the StringFunctions() page and I can't find anything about how to concatenate strings. Any ideas?
mjb7

Use sprint for concatenation

Post by mjb7 »

Looking through some other posts I found you can use sprint to concatenate strings.

The following example will concatenate a & b into c:

strdef a,b,c
a = "foo"
b = "bar"
sprint(c,"%s%s",a,b)
Post Reply