Deprecated: Using ${var} in strings is deprecated, use {$var} instead in /mnt/web218/a3/28/510129628/htdocs/config.php on line 36 Deprecated: Using ${var} in strings is deprecated, use {$var} instead in /mnt/web218/a3/28/510129628/htdocs/config.php on line 37 Deprecated: Using ${var} in strings is deprecated, use {$var} instead in /mnt/web218/a3/28/510129628/htdocs/lang.php on line 55 Deprecated: Using ${var} in strings is deprecated, use {$var} instead in /mnt/web218/a3/28/510129628/htdocs/lang.php on line 55 Deprecated: Using ${var} in strings is deprecated, use {$var} instead in /mnt/web218/a3/28/510129628/htdocs/lang.php on line 110 Deprecated: Using ${var} in strings is deprecated, use {$var} instead in /mnt/web218/a3/28/510129628/htdocs/lang.php on line 110 Deprecated: Using ${var} in strings is deprecated, use {$var} instead in /mnt/web218/a3/28/510129628/htdocs/border_html5.php on line 201 Deprecated: Using ${var} in strings is deprecated, use {$var} instead in /mnt/web218/a3/28/510129628/htdocs/border_html5.php on line 201 Deprecated: Using ${var} in strings is deprecated, use {$var} instead in /mnt/web218/a3/28/510129628/htdocs/border_html5.php on line 216 Deprecated: Using ${var} in strings is deprecated, use {$var} instead in /mnt/web218/a3/28/510129628/htdocs/border_html5.php on line 216 Deprecated: Using ${var} in strings is deprecated, use {$var} instead in /mnt/web218/a3/28/510129628/htdocs/border_html5.php on line 231 Deprecated: Using ${var} in strings is deprecated, use {$var} instead in /mnt/web218/a3/28/510129628/htdocs/border_html5.php on line 232 Deprecated: Using ${var} in strings is deprecated, use {$var} instead in /mnt/web218/a3/28/510129628/htdocs/border_html5.php on line 232 Deprecated: Using ${var} in strings is deprecated, use {$var} instead in /mnt/web218/a3/28/510129628/htdocs/border_html5.php on line 233 Deprecated: Using ${var} in strings is deprecated, use {$var} instead in /mnt/web218/a3/28/510129628/htdocs/border_html5.php on line 233 GLBasic User Manual

GLBasic User Manual

Main sections

REVINSTR()

pos% = REVINSTR(haystack$, needle$, start%=-1)



Finds a substring needle$ in a string haystack$ in reverse direction. The parameter start% specifies the start position in haystack$. A value of -1 starts the search at the end of haystack$. Specifying 0 would only search at the very beginning of the haystack$.


LOCAL haystack$ = "the quick brown fox jumps over the lazy dog"
LOCAL pos%
// Returns 31
pos = REVINSTR(haystack$, "the")
STDOUT "pos1: "+pos+"\n"

// Returns 0
pos = REVINSTR(haystack$, "the", 16)
STDOUT "pos2: "+pos+"\n"

// Returns 41
pos = REVINSTR(haystack$, "g")
STDOUT "g: "+pos+"\n"


KEYWAIT

See also...