Last active
January 18, 2024 09:38
-
-
Save CEZERT/388362bf4a53cf3ebbde80d910832a52 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The QGIS expression is designed to split a string (found in the "Code_ouvra" field) by underscores ('_'), and then recombine the first three elements of the resulting array into a new string, again separated by underscores. | |
```qgis | |
array_to_string(array_slice(string_to_array("Code_ouvra", '_'), 0, 2), '_') | |
``` | |
This expression does the following: | |
1. `string_to_array("Code_ouvra", '_')`: Splits the "Code_ouvra" string into an array using '_' as the separator. | |
2. `array_slice(..., 0, 2)`: Takes a slice of the array from the first element (index 0) to the third element (index 2). | |
3. `array_to_string(..., '_')`: Converts the sliced array back into a string, with elements separated by '_'. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment