std.atof

FLOATstd.atofSTRINGs

Available in all subroutines.

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

Example

if (std.atof(req.http.X-String) > 21.82) {
set req.http.X-TheAnswer = "Found";
}

Try it out

std.atof 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.

Geofencing / geoblocking content by region

Group countries to cache content by custom regions or reject requests from some regions entirely.

Comprehensive logging

Fastly offers a myriad of different variables that you can log. See and test a large collection here.

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.