### Length() Function Source: https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-string/mc-ampscript-reference-string-length The Length() function returns the number of characters in a given string. ```APIDOC ## Length() ### Description Returns the number of characters in a string. ### Method Ampscript Function ### Endpoint N/A ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Parameters * **sourceString** (string) - Required - The string that you want to find the length of. ### Request Example ```ampscript %%[ SET @url = "https://www.example.com/very/long/url/path/that/needs/shortening" IF Length(@url) > 50 THEN SET @shortUrl = WrapLongUrl(@url) OUTPUT(Row(@shortUrl,1)) ELSE OUTPUT(@url) ENDIF ]%% ``` ### Response #### Success Response (200) Returns the character count of the input string. #### Response Example ``` 58 ``` ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.