Anytime Help Center

Contact Us

If you still have questions or prefer to get help directly from an agent, please submit a request.
We’ll get back to you as soon as possible.

Please fill out the contact form below and we will reply as soon as possible.

  • Support
  • Guest
  • Log In
English (US)
US English (US)
DE German
CN Chinese
MX Spanish (Mexico)
Chinese (Simplified)
  • AKG
    Microphones Wireless Integrated Systems Automatic Mixers Headphones Discontinued Products (AKG) General AKG Inquiries Certifications (AKG)
  • AMX
    Networked A/V Distribution (AVoIP) Traditional A/V Distribution Video Signal Processing Architectural Connectivity User Interfaces Control Processing Power (AMX) Programming (AMX) Software (AMX) Discontinued Products (AMX) General AMX Inquiries Certifications (AMX)
  • BSS
    Soundweb™ Omni Soundweb™ London Soundweb™ Contrio™ Software (BSS) Discontinued Products (BSS) General BSS Inquiries Certifications (BSS)
  • Crown
    CDi DriveCore Series CDi Series Commercial Series ComTech Series DCi DriveCore Series I-Tech HD Series XLC series XLi Series XLS DriveCore 2 Series XTi 2 Series Discontinued Products (Crown) Software (Crown) General Crown Inquiries Certifications (Crown)
  • dbx
    CX Series 500 Series DriveRack Personal Monitor Control ZonePRO Zone Controllers FeedBack Suppression Microphone Preamps Dynamics Processors Crossovers Equalizers Software (dbx) Discontinued Products (dbx) General dbx Inquiries Certifications (dbx)
  • Flux::
    Immersive Processing Analysis Subscriptions
  • JBL
    Cinema Sound Installed Live Portable Tour Sound Recording & Broadcast Software (JBL) Discontinued Products (JBL) Video Manual Series (JBL) General JBL Inquiries Certifications (JBL)
  • Lexicon
    Plugins Effects Processors Cinema Discontinued Products (Lexicon) Video Manual Series (Lexicon) General Lexicon Inquiries Certifications (Lexicon)
  • Martin
    Atomic ELP ERA Exterior MAC P3 VC VDO Tools Discontinued Products (Martin) General Martin Inquiries Certifications (Martin)
  • Soundcraft
    Digital Analog Connected Analog Only Discontinued Products (Soundcraft) Video Manual Series (Soundcraft) General Soundcraft Inquiries Certifications (Soundcraft)
  • General HARMAN Inquiries
    Dante
+ More
  • Home
  • AMX
  • Programming (AMX)
  • Programming

AMX SPLIT_STRING

Frequently Asked Questions

Written by Will Fraser

Updated at February 3rd, 2026

Table of Contents

Brand: Models: Question:   Answer:

Brand:

  • AMX

Models:

  • Netlinx

Question:  

Is there a way to assign sub-strings separated by delimiters from a string to an array?


Answer:

See SPLIT_STRING.axi located in the download: 

662-DL1-SPLIT_STRING​.ZIP

PROGRAM_NAME='SPLIT_STRING'
(***********************************************************)
(***********************************************************)
(*  FILE_LAST_MODIFIED_ON: 04/05/2006  AT: 09:00:25        *)
(***********************************************************)
(* System Type : NetLinx                                   *)
(***********************************************************)
(* REV HISTORY:                                            *)
(***********************************************************)
(*
   $History: $
*)
(***********************************************************)
(*          DEVICE NUMBER DEFINITIONS GO BELOW             *)
(***********************************************************)
DEFINE_DEVICE
(***********************************************************)
(*               CONSTANT DEFINITIONS GO BELOW             *)
(***********************************************************)
DEFINE_CONSTANT
(***********************************************************)
(*              DATA TYPE DEFINITIONS GO BELOW             *)
(***********************************************************)
DEFINE_TYPE
(***********************************************************)
(*               VARIABLE DEFINITIONS GO BELOW             *)
(***********************************************************)
DEFINE_VARIABLE
(***********************************************************)
(*               LATCHING DEFINITIONS GO BELOW             *)
(***********************************************************)
DEFINE_LATCHING
(***********************************************************)
(*       MUTUALLY EXCLUSIVE DEFINITIONS GO BELOW           *)
(***********************************************************)
DEFINE_MUTUALLY_EXCLUSIVE
(***********************************************************)
(*        SUBROUTINE/FUNCTION DEFINITIONS GO BELOW         *)
(***********************************************************)
(* EXAMPLE: DEFINE_FUNCTION <RETURN_TYPE> <NAME> (<PARAMETERS>) *)
(* EXAMPLE: DEFINE_CALL '<NAME>' (<PARAMETERS>) *)
DEFINE_FUNCTION SPLIT_STRING (CHAR strINPUT[], CHAR strDELIMITER[], CHAR arOUTPUT[][])
(********************************************************************************)
(* SPLIT_STRING FUNCTION        *)
(* Populates an array with the sub-strings from a delimited string   *)
(* The syntax:          *)
(*           *)
(* SPLIT_STRING (CHAR strINPUT[], CHAR strDELIMITER[], CHAR arOUTPUT[][])  *)
(*           *)
(* PARAMETERS:          *)
(* strINPUT = string variable containing delimited data    *)
(* strDELIMITER = value of the delimiter      *)
(* arOUTPUT = the array that will be populated      *)
(*           *)
(* RESULT:          *)
(* arOUTPUT elements will contain the sub-strings     *)
(*           *)
(* EXAMPLES:          *)
(* strVAR = 'this,is,a,string,with,comma,delimiters'     *)
(* SPLIT_STRING(strVAR,',',arRESULT)       *)
(* RESULT:          *)
(* arRESULT[1] is 'this'        *)
(* arRESULT[2] is 'is'         *)
(* arRESULT[3] is 'a'         *)
(* arRESULT[4] is 'string'        *)
(* arRESULT[5] is 'with'        *)
(* arRESULT[6] is 'comma'        *)
(* arRESULT[7] is 'delimiters'        *)
(*           *)
(* NOTE:          *)
(* arRESULT must be defined in DEFINE_VARIABLE as a multidimensional array  *)
(* specifying the maximum number of elements, and maximum element length  *)
(*           *)
(* DEFINE_VARIABLE         *)
(* CHAR arRESULT[50][50]        *)
(*           *)
(********************************************************************************)
STACK_VAR
CHAR strTEMP[1000]
CHAR strTRASH[100]
INTEGER nLOOP
INTEGER lenDELIMITER
{
   strTEMP = strINPUT //use a temporary string to keep integrity of original string
   nLOOP = 1 //variable used to track how many sub-strings there are and how many elements should be used
   lenDELIMITER = LENGTH_STRING(strDELIMITER) //length of delimiter
   WHILE(LENGTH_STRING(strTEMP)) //keep looking until the end of the string
   {
IF(FIND_STRING(strTEMP,strDELIMITER,1)) //look for the delimiter, if it is in the string proceed
{
    arOUTPUT[nLOOP]=REMOVE_STRING(strTEMP,strDELIMITER,1) //assign sub-strings to array element
    IF(RIGHT_STRING(arOUTPUT[nLOOP],lenDELIMITER)=strDELIMITER)
    {
 SET_LENGTH_STRING(arOUTPUT[nLOOP],LENGTH_STRING(arOUTPUT[nLOOP])-lenDELIMITER) //remove delimiter from array element
    }
}
ELSE //no more delimiters
{
    arOUTPUT[nLOOP]=strTEMP //assign remaining portion of string to array element
    SET_LENGTH_STRING(strTEMP,0) //clear temporary string to kill loop
}
SET_LENGTH_ARRAY(arOUTPUT,nLOOP) //set length of array
nLOOP++ //increment
   }
}
(***********************************************************)
(*                STARTUP CODE GOES BELOW                  *)
(***********************************************************)
DEFINE_START
(***********************************************************)
(*                THE EVENTS GO BELOW                      *)
(***********************************************************)
DEFINE_EVENT
(*****************************************************************)
(*                                                               *)
(*                      !!!! WARNING !!!!                        *)
(*                                                               *)
(* Due to differences in the underlying architecture of the      *)
(* X-Series masters, changing variables in the DEFINE_PROGRAM    *)
(* section of code can negatively impact program performance.    *)
(*                                                               *)
(* See Ԅifferences in DEFINE_PROGRAM Program ExecutionԠsection *)
(* of the NX-Series Controllers WebConsole & Programming Guide   *)
(* for additional and alternate coding methodologies.            *)
(*****************************************************************)
DEFINE_PROGRAM
(*****************************************************************)
(*                       END OF PROGRAM                          *)
(*                                                               *)
(*         !!!  DO NOT PUT ANY CODE BELOW THIS COMMENT  !!!      *)
(*                                                               *)
(*****************************************************************)

Related Videos

guidelines inquiry

Was this article helpful?

Yes
No
Give feedback about this article

Table of Contents

Brand: Models: Question:   Answer:

Related Articles

  • AMX REPLACE_STRING
  • AMX FIND_STRING_REV
  • AMX Device Network Ports

Related Articles

  • AMX REPLACE_STRING
  • AMX FIND_STRING_REV
  • AMX Device Network Ports
Copyright © HARMAN Professional. All rights reserved. Privacy Policy | Terms of Use
Expand