mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-20 21:31:32 +02:00
Merge commit '5be51ac3db225d5df501ed1fa1499c41d97dbf65'
This commit is contained in:
@@ -2,13 +2,11 @@
|
||||
title: cast.ToInt
|
||||
description: Converts a value to a decimal integer (base 10).
|
||||
keywords: []
|
||||
action:
|
||||
aliases: [int]
|
||||
related:
|
||||
- functions/cast/ToFloat
|
||||
- functions/cast/ToString
|
||||
returnType: int
|
||||
signatures: [cast.ToInt INPUT]
|
||||
params:
|
||||
functions_and_methods:
|
||||
aliases: [int]
|
||||
returnType: int
|
||||
signatures: [cast.ToInt INPUT]
|
||||
aliases: [/functions/int]
|
||||
---
|
||||
|
||||
@@ -46,8 +44,7 @@ With a hexadecimal (base 16) input:
|
||||
{{ int "0x11" }} → 17 (int)
|
||||
```
|
||||
|
||||
{{% note %}}
|
||||
Values with a leading zero are octal (base 8). When casting a string representation of a decimal (base 10) number, remove leading zeros:
|
||||
> [!note]
|
||||
> Values with a leading zero are octal (base 8). When casting a string representation of a decimal (base 10) number, remove leading zeros:
|
||||
|
||||
`{{ strings.TrimLeft "0" "0011" | int }} → 11`
|
||||
{{% /note %}}
|
||||
|
Reference in New Issue
Block a user