Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I should probably know how to do this but my brain's gone numb.
I need all but the last word of a sentence.
For example if i have a sentence...
This is a sentence then i need just the This is a part
So the sentence could have any number of spaces in it and i just need to lose the last word of it
Example2
Here is a slightly longer sentence would leave me with Here is a slightly longer
Thanks for help
try
Left('Here is a slightly longer sentence',Index('Here is a slightly longer sentence', ' ', -1)-1)
Hi!
Try Subfield('This is a sentence', Subfield('This is a sentence', ' ',-1), 1)
try
Left('Here is a slightly longer sentence',Index('Here is a slightly longer sentence', ' ', -1)-1)
Thanks Both for the replies
For reasons I can't accurately explain Anders solution didn't quite work for all scenarios but Dilip's was fine.
eg
One of my sentences said the following
aecom and pelli clarke pelli
Anders solution produced: aecom and
whilst Dilip's produced: aecom and pelli clarke
There seem to be a few that seem to be like that.
Anyway interesting and many thanks
Anders solution is retrieving the last word using the second subfield() and uses this as separator for the first subfield.
This should work as long as the last word does not repeat in the sentence (like pelli occurs twice in your sample).
Hence better use Dilip's solution which relies only on space as separator, which is the separator in your original requirement.