# AFTERATNUM()

Returns string portion after nth occurence of substring

Syntax

  AFTERATNUM (<cStringToMatch>, <cString>, [<nCounter>],
  [<nIgnore>] ) --> cRestString

Arguments

  <cStringToMatch> is the substring scanned for <cString> is the scanned string [<nCounter>] determines how many occurences are of <cStringToMatch> in <cString> are searched Default: search last occurence [<nIgnore>] determines how many character from the start should be ignored in the search Default: 0

Returns

  <cRestString> the portion of <cString> after the <nCounter>th occurence of <cStringToMatch> in <cString> If such a rest does not exist, an empty string is returned.

Description

  This function scans <cString> for <cStringToMatch>. After the <nCounter>th match (or the last one, depending on the value of <nCounter>) has been found, the portion of <cString> after that match will be returned. If there aren't enough matches or the last match is identical to the end of <cString>, an empty string will be returned. After a match has been found, the function continues to scan after that match if the CSETATMUPA() switch is turned off, with the second character of the matched substring otherwise. The function will also consider the settings of SETATLIKE().

Examples

          ? AFTERATNUM ("!", "What is the answer ? 4 ! 5 !") -> ""
          ? AFTERATNUM ("!", "What is the answer ? 4 ! 5 ?") -> " 5 ?"

    Tests
          AFTERATNUM ("..", "..This..is..a..test!") == "test!"
          AFTERATNUM ("..", "..This..is..a..test!", 2) == "is..a..test!"
          AFTERATNUM ("..", "..This..is..a..test!", 2, 2) == "a..test!"

Status

  Ready

Compliance

  AFTERATNUM() is compatible with CT3's AFTERATNUM().

Platforms

  All

Files

  Source is atnum.c, library is libct.

See Also

- ATNUM()
- BEFORATNUM()
- CSETATMUPA()
- SETATLIKE()