STRLEN

Since 1.1.0Strings

Syntax

STRLEN key
  • Flags: fast, readonly
  • ACL categories: @fast, @read, @string
  • Arity: 2

Returns the length, in bytes, of the string at key.

Reply

  • The length.
  • 0 if the key does not exist.
  • A WRONGTYPE error if the key is not a string.

Examples

> SET k "hello world"
OK
> STRLEN k
(integer) 11
> STRLEN missing
(integer) 0