simple task - joining text (strings)

colinyell's icon

Hi All,

I want to have a directory path in one box, a file stem in another and add an extenstion onto the end. So, for example I would like to have

directory = c:/my documents/
file stem = my_movie

and create the following full file paths for the movie and sound files:

movie file = c:/my documents/my_movie.mov
sound file = c:/my documents/my_movie.wav

how can I join strings (text) like this? In a programming language it would be known as "concatenate" or similar.

Thanks

xenakis's icon

Hi there,

Try the zl object. It's great dealing with lists. You might also want to look at sprinf

something like 'sprintf %s%s%s' This would give you 3 inlets in which you could send your messages.

Hope that helps.
xen

Emmanuel Jourdan's icon

On 10 sept. 07, at 14:29, colin yellowley wrote:

> Hi All,
>
> I want to have a directory path in one box, a file stem in another
> and add an extenstion onto the end. So, for example I would like to
> have
>
> directory = c:/my documents/
> file stem = my_movie
>
> and create the following full file paths for the movie and sound
> files:
>
> movie file = c:/my documents/my_movie.mov
> sound file = c:/my documents/my_movie.wav
>
> how can I join strings (text) like this? In a programming language
> it would be known as "concatenate" or similar.

sprintf is your friend. The symout argument sets the output as one
symbol (so it'll add the double quotes if required).

ej

Max Patch
Copy patch and select New From Clipboard in Max.

colinyell's icon

Brilliant. Thanks a lot for that