Alphabetical case insensitive grouping of results My question is about grouping results alphabetically in a case insensitive way in Drupal 8. I have a view displaying people's names alphabetically grouped by last name. My problem is the following: I have some people with last name that starts with upper case D and other whose last name starts with lower case d (Example: de XXX). Right now the upper case D and the lower case d are grouped separately. I need to be able to group them together.
To group all of your results by Last initial, capitalized:
First, under Format &gt; Settings &gt; Grouping field X, make sure you check the box to &quot;Use rendered output to group rows&quot;.
Second, update the field settings for the field you're using to group the results - under Rewrite Results, check &quot;Trim this field to a maximum number of characters,&quot; and enter 1 for the length.
Finally, again under Rewrite Results, check the box to &quot;Override the output of this field with custom text&quot;. You can use twig in the custom text field and leverage twig's upper filter to convert the entire string to uppercase. You'll have to check the Replacement Patterns for the correct field name to use in your case, but the end result should look something like:
{{ field_last_name|upper }}

The result is your view results grouped by last initial, capitalized (whether they actually start with a capital letter or not).