Share this page

# Example: while

The following example uses a while statement to loop through string str, searching for the first non-numeric character. The loop will continue until the expression is_digit becomes false i.e when the next character in str is not a digit but a non-numeric character.

        int is_digit = TRUE, i = 0;
        char * str = "1234567k89";
        int len = strlen(str);
        while (is_digit){
            if (i == len) {
                lr_output_message ("No letters found in string");
                return -1;
            }
            is_digit = isdigit(str[i++]);
        }
        lr_output_message ("The first letter appears in character %d of string", i);

    Example: Output:
    Action.c(18): The first letter appears in character 8 of string

Tips to improve your search results... VuGen Function Reference Version 25.1-25.3 Function Reference 25.1-25.3 All View Local Help Center View Online Help Center Version: