Skip to content

dos_strfind

Dale Fugier edited this page Jul 1, 2026 · 1 revision

Finds a character or substring inside a larger string.

Syntax

(dos_strfind string substring [index])

Parameters

string

A string.

substring

A substring to search for.

index

The zero-based index of the character in string to begin the search with, or 0 to start from the beginning. The character at index is excluded from the search if index is not equal to 0. The default value of index is 0.

Returns

The zero-based index of the first character in string that matches the requested substring or characters; -1 if the substring or character is not found.

nil on error.

Example

Command: (dos_strfind "AutoCAD 2006" "C")
4

Command: (dos_strfind "The stars are aligned." "e" 5)
12

Clone this wiki locally