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 FIND_STRING_REV

Frequently Asked Questions

Written by Will Fraser

Updated at February 3rd, 2026

Table of Contents

Brand: Models: Question:   Answer: Download: Code Block:

Brand:

  • AMX

Models:

  • Netlinx

Question:  

Is there a way to search for characters in a string starting at the end?


Answer:

Download:

See FIND_STRING_REV.axi located in the download:

 660-DL1-FIND_STRING_REV.ZIP

Code Block:

PROGRAM_NAME = 'FIND_STRING_REV'
(*******************************************************)
(***********************************************************)
(*  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 INTEGER FIND_STRING_REV(CHAR strSTRING[ ], CHAR strSEARCH[ ],INTEGER nPOS)
(****************************************************************************************)
(* FIND_STRING_REV FUNCTION         *)
(* Searches through a string for a specified sequence of     *)
(* characters from right to left. The syntax:       *)
(*            *)
(* INTEGER FIND_STRING_REV(CHAR strSTRING[ ], CHAR strSEARCH[ ], INTEGER nPOS)   *)
(*            *)
(* PARAMETERS:           *)
(* strSTRING = the string of a character to search      *)
(* strSEARCH = the sequence of characters to search for     *)
(* nPOS = the starting character position for the search     *)
(*            *)
(* RESULT: A 16-bit unsigned integer representing the      *)
(* character location of strSEARCH in strSTRING from the left     *)
(* Any error condition returns 0.        *)
(*            *)
(* EXAMPLE:           *)
(* strVAR = 'ABC ABC ABC'         *)
(* nFIND = FIND_STRING_REV(strVAR, 'ABC', 8)       *)
(* RESULT:           *)
(* nFIND is 5           *)
(*            *)
(****************************************************************************************)
STACK_VAR INTEGER nFOUNDAT, nLOOP, jLOOP
{
   nFOUNDAT=0 //storage position where string was located
   nLOOP=1 //the variable to track how many times the search has been conducted and multiply the search length
   jLOOP=0 //the variable to track how many times the search has been conducted one character at a time
   WHILE(nFOUNDAT=0) //keep searching until the string is found
   {
IF((LENGTH_STRING(strSEARCH)*nLOOP) < nPOS) //the search multiplied by the times searched is less then the starting point
{
    nFOUNDAT = FIND_STRING(strSTRING,strSEARCH,(nPOS-(LENGTH_STRING(strSEARCH)*nLOOP)-jLOOP)) //start at the end
    IF(nFOUNDAT>nPOS)//Is the location the string was found greater than the starting point?
    {
 nFOUNDAT=0//Clear the nFOUNDAT value to continue the search
 IF((nFOUNDAT-nPOS)>LENGTH_STRING(strSEARCH))//the difference is greater than the location, continue searching one character back
 {
     nLOOP--//decrease the multiplied search
     jLOOP++//increase the count on characters back to search
 }
    }
}
ELSE
{
    nFOUNDAT = FIND_STRING(strSTRING,strSEARCH,1) //start at beginning
    RETURN nFOUNDAT //return position string was found
}
nLOOP++
   }
   RETURN nFOUNDAT //return position string was found
}
(***********************************************************)
(*                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

help guidelines

Was this article helpful?

Yes
No
Give feedback about this article

Table of Contents

Brand: Models: Question:   Answer: Download: Code Block:

Related Articles

  • AMX Device Network Ports
  • AMX G5 Listview Button Feature Summary
  • Route Audio Mode Using Audio Architect

Related Articles

  • AMX Device Network Ports
  • AMX G5 Listview Button Feature Summary
  • Route Audio Mode Using Audio Architect
Copyright © HARMAN Professional. All rights reserved. Privacy Policy | Terms of Use
Expand