std.strlen

INTEGERstd.strlenSTRINGs

Available in all subroutines.

Returns the length of the string s. For example, std.strlen("Hello world!"); will return 12 (because the string includes whitespaces and punctuation).

Example

if (strlen(req.http.Cookie > 1024)) {
unset req.http.Cookie;
}

Try it out

std.strlen is used in the following solution recipes, which show real world use cases. Click RUN to provision a Fastly service, execute the code on Fastly, and see how the function behaves.

Compute intersection of two lists

Useful for comparing capabilities with required permissions.

User contributed notes

We welcome comments that add use cases, ideas, tips, and caveats. All comments will be moderated before publication. To post support questions, visit our support center and we'll find you the help you need.