strcatk
Prev | Orchestra Opcodes and Operators | Next

## strcatk

strcatk — Concatenate strings (k-rate)

## Description

Concatenate two strings and store the result in a variable. strcatk does the concatenation both at initialization and performance time. It is allowed for any of the input arguments to be the same as the output variable.

## Syntax

    Sdst strcatk Ssrc1, Ssrc2

## Examples

Here is an example of the strcatk opcode. It uses the file strcatk.csd.

Example 969. Example of the strcatk opcode.

See the sections Real-time Audio and Command Line Flags for more information on using command line flags.

    <CsoundSynthesizer>
    <CsOptions>
    ; Select audio/midi flags here according to platform
    ; Audio out   Audio in
    -odac           -iadc    ;;;RT audio I/O
    ; For Non-realtime ouput leave only the line below:
    ; -o strcatk.wav -W ;;; for file output any platform
    </CsOptions>
    <CsInstruments>

      sr	    =  48000
      ksmps	    =  16
      nchnls    =  2
      0dbfs	    =  1

    ; Example by Jonathan Murphy 2007

        instr 1

      S1	    =  "1"
      S2	    =  " + 1"
      ktrig	    init      0
      kval	    init      2
    if (ktrig == 1) then
      S1	    strcatk   S1, S2
      kval	    =  kval + 1
    endif
      String    sprintfk  "%s = %d", S1, kval
    	    puts      String, kval
      ktrig	    metro     1

        endin

    </CsInstruments>
    <CsScore>
    i1 0 10
    e
    </CsScore>
    </CsoundSynthesizer>

Its output should include lines like this:

    1 + 1 = 2
    1 + 1 + 1 = 3
    1 + 1 + 1 + 1 = 4
    1 + 1 + 1 + 1 + 1 = 5
    1 + 1 + 1 + 1 + 1 + 1 = 6
    1 + 1 + 1 + 1 + 1 + 1 + 1 = 7
    1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 = 8
    1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 = 9
    1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 = 10
    1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 = 11
    1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 = 12

## See also

strcat

## Credits

Author: Istvan Varga
2005

New in version 5.02

Prev | Up | Next
strcat | Home | strcmp