std.atoi

INTEGERstd.atoiSTRINGs

Available inall subroutines.

Takes a string (which represents an integer) as an argument and returns its value. Behaves as if calling std.strtol with a base of 10.

Example

if (std.atoi(req.http.X-Decimal) == 42) {
set req.http.X-TheAnswer = "Found";
}

Try it out

std.atoi is used in the following code examples. Examples apply VCL to real-world use cases and can be deployed as they are, or adapted for your own service. See the full list of code examples for more inspiration.

Click RUN on a sample below to provision a Fastly service, execute the code on Fastly, and see how the function behaves.

Create self-destructing URLs for time-limited access

Make URLs expire after a configurable period.