# Trim - fonction de script et fonction de graphique

Trim() renvoie la chaîne d'entrée exempte de tout espace de début et de fin.

Trim(text)

chaîne

[](https://help.qlik.com/en-US/sense/Subsystems/Hub/Content/Sense_Hub/Scripting/StringFunctions/Trim.htm)

#### Exemples et résultats :

Expression de graphique

| Exemple | Résultat |
| --- | --- |
| `Trim( ' abc' )` | Renvoie 'abc'. |
| `Trim( 'abc ' )` | Renvoie 'abc'. |
| `Trim( ' abc ' )` | Renvoie 'abc'. |

Script de chargement

```
Set verbatim=1; 
					
T1:
Load *, len(TrimString) as TrimStringLength;          
Load *, trim(String) as TrimString;
Load *, len(String) as StringLength;               
Load * inline [
String
'   abc    '
' def  '](delimiter is '\t');  
				
```

Note InformationsL'instruction "Set verbatim=1" est incluse dans l'exemple pour garantir que les espaces ne sont pas automatiquement tronqués avant la démonstration de la fonction trim. Voir [Verbatim](https://help.qlik.com/fr-FR/sense/May2025/Subsystems/Hub/Content/Sense_Hub/Scripting/SystemVariables/Verbatim.htm) pour plus d'informations.

Résultat :

| Chaîne | StringLength | TrimStringLength |
| --- | --- | --- |
| def | 6 | 3 |
| abc | 10 | 3 |