ExpressionEngineFunction : function to extract indexOf a character inside a string

#1

Hi,
I’m not able to find in ExpressionEngineFunction a function that returns the index of a particular character inside a string…do you know if is possible to calculate it? I want use it in stored calc.
I see that if I want to use
substring(str, start, end)
I have to pass an integer as start / end but I want calculate it at runtime because it is not static.

Thanks,
Laura

0 Likes

#2

Hm, would it be too crazy to use metrics for those indices?
It is probably better to try with bindings, if you can have the index values available at evalMetric time.

0 Likes

#3

what about to split the string based on the character you are looking for and then count the length of the splitted strings to understand the position?

0 Likes

#4

Hey,
thanks for the reply. I will try to split the string like suggested by Marco.

Thanks!
Laura

0 Likes