> For the complete documentation index, see [llms.txt](https://docs.hyperdbg.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.hyperdbg.org/commands/scripting-language/functions/strings/strlen.md).

# strlen

### Function

> strlen

### Syntax

> strlen( Expression );

### Parameters

**\[Expression (Address)]**

A [MASM-like expression](https://docs.hyperdbg.org/commands/scripting-language/assumptions-and-evaluations) or a string to evaluate which is the address of the target location to compute the string length.

### Description

Counts the length of the ASCII string from an address.

### Return value

The return value is the length of the strings which is located at the target address. If there is an error or if the address is invalid then, it returns `0`.

### Examples

`StringLen = strlen(@rcx + 10);`

Adds 0x10 to the **rcx** register and counts the length of the ASCII string, which is determined by the terminating null-character and saves the result into the `StringLen` variable.

`StringLen = strlen(dq(@rcx));`

Counts the ASCII string length as an 8-byte hex address, pointed by the **rcx** register, and saves the result into the `StringLen` variable.

`StringLen = strlen(0xffff83811f265040);`

Counts the ASCII string length located at `0xffff83811f265040` address and saves the result into the `StringLen` variable.

`StringLen = strlen("ABCD");`

Counts ASCII the string length of the "**ABCD**" string and saves the result into the `StringLen` variable.

### Remarks

None

### Related

[wcslen](https://docs.hyperdbg.org/commands/scripting-language/functions/strings/wcslen)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.hyperdbg.org/commands/scripting-language/functions/strings/strlen.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
