RIGHT$ function

Purpose:

RIGHT$ returns the rightmost substring of a string.

Syntax:

SubStr = RIGHT$(MainStr AS STRING, Length AS INTEGER)

Return Value:

  • Data type: STRING
    SubStr The rightmost substring of MainStr$.

Parameters:

  • Data type: STRING
    MainStr A string from which the rightmost substring is to be copied.
  • Data type: INTEGER
    Length The rightmost substring length.

Example:

DIM SubStr$

SubStr$ = RIGHT$("abcdefg", 2)

PRINT SubStr$

Result:

fg

BCX Console Sample Programs using the RIGHT$ function.


RIGHTSTR function

Purpose:

RIGHTSTR searching from the right, returns TRUE if Match$ is a proper substring of MainStr$ or else FALSE if Match$ is not found.

Syntax:

RetVal = RIGHTSTR(MainStr AS STRING, Match AS STRING [,CaseSensitivity AS INTEGER])

Return Value:

  • Data type: INTEGER
    RetVal 1 if Match$ is a proper substring of MainStr$ or else 0 if Match$ is not found.

Parameters:

  • Data type: STRING
    MainStr String in which substring is to be located.
  • Data type: STRING
    Match Substring to be located.
  • Data type: INTEGER
    CaseSensitivity [OPTIONAL] Default is 0 which is case sensitive. Set it to 1 for a case insensitive search.

Example:

DIM RetVal%

RetVal% = RIGHTSTR("abcdefg", "defg")

PRINT RetVal%

Result:

1