rid
rid

Reputation: 63442

Expression for finding an index in an array

How can I find the first character in a string that is the space character and return its index, with a single expression that can be used as part of Contract_Cases?

For example, if the string is:

Input : constant String := "abc def";

then the expression should return 4.

Upvotes: 0

Views: 290

Answers (1)

Simon Wright
Simon Wright

Reputation: 25491

The question originally asked for the first non-blank character in the string, for which you need Ada.Strings.Fixed.Index_Non_Blank (ARM A.4.3(12) and (61)).

As amended (the first blank character in the string), use Ada.Strings.Fixed.Index - see the OP’s comment below.

Upvotes: 4

Related Questions