Get first word

Hi, I’m trying to organise an entire library of detail items to be placed on a detail view. How do I get the first word from a list of multiple words and legnths? I was going to group by key with that. There’s string drop first word and last word but not get first word. Tried finding something to show where the first space in the string would be too but no luck.

Just to show first word from the list of words encase thats a poor description

Two ways to quickly get this information:


awesome thanks Jacob. That’s handy. Enjoyed the read too :rofl:

1 Like

A python coding alternative, just to give everyone some options :slight_smile:

# create a list to populate with results
result = []

# to iterate over a list of strings
for i in IN[0]:
	# trim any left white space if any is present
	left_trimmed = i.lstrip()
	# split strings and get the first word before the first "space"
	first = left_trimmed.split(' ',1)[0]
	# add the first word in the string to the list of results

# output the list of first words
OUT = result

The Substring method might need an additional step for sentences with just one word

String.Substring(st,0,(String.IndexOf((st+" ")," ")));

1 Like