I want to extract the first word of a message attribute.
This:
{{ state_attr(‘calendar.ashford_borough_council’, ‘message’) }}
produces this:
Recycling (green bin / clear sacks)
How can i parse it and just extract the ‘Recycling’
I want to extract the first word of a message attribute.
This:
{{ state_attr(‘calendar.ashford_borough_council’, ‘message’) }}
produces this:
Recycling (green bin / clear sacks)
How can i parse it and just extract the ‘Recycling’
I think this can do it
{{ state_attr(‘calendar.ashford_borough_council’, ‘message’).split(' ')[0] }}
Nice one thanks!
(the apostrophes weren’t right, but that’s just a copy/paste formatting issue)
Yeah, I did not see the autocorrect on the apostrophes. Good catch!