Ad

How Can I Do An IndexOf() In Lotus Notes Formula Language (@ Commands)?

- 1 answer

I can't find this anywhere in the Domino Designer help. It seems so straightforward!

All I need to do is find the position of a character in a string.

Ad

Answer

(edited) Please see the answer from charles ross instead. https://stackoverflow.com/a/19437044/11293

My less efficient method is below.


If you really need the character position though you could do this:

REM {
    S  Source string
    F  Character to find
    R  Location of character in string or 0
};

S := "My string";
F := "t";
LEN_S := @Length(S);
R := 0;

@For(I := 1; I < LEN_S; I := I + 1;
    @If(@Middle(S; I; 1) = F;
        @Do(R := I; I := LEN_S);
        @Nothing
    )
);
Ad
source: stackoverflow.com
Ad