Skip to content

[pkg/ottl] New function: Index #40351

@edmocosta

Description

@edmocosta

Component(s)

pkg/ottl

Is your feature request related to a problem? Please describe.

OTTL currently does not support finding the index of a particular item within a slice or string.

Describe the solution you'd like

The new Index(source, value) function would be used to find the index of the first occurrence of value in source, being value the item we're looking for, and source a slice or string. If the value is not present, -1 could be returned.

Describe alternatives you've considered

No response

Additional context

No response

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions