string_rpos

Downloadstring_rpos(substr,str)   Returns the right-most position of the given substring within the given string.
/*
**  Usage:
**      string_rpos(substr,str)
**
**  Arguments:
**      substr      a substring of text
**      str         a string of text
**
**  Returns:
**      the right-most position of the given
**      substring within the given string
**
**  GMLscripts.com
*/

{
    var sub,str,pos,ind;
    sub = argument0;
    str = argument1;
    pos = 0;
    ind = 0;
    do {
        pos += ind;
        ind = string_pos(sub,str);
        str = string_delete(str,1,ind);
    } until (ind == 0);
    return pos;
}

Click if you've used this script[Please Login]
Projects: 12


comments powered by Disqus