---
title: "strRight"
canonical: "https://help.vicon.com/space/Shogun112/31227930/strRight"
format: markdown
---
# Description

Extracts a sub-string from the end of another string.

Extracts the last (right-most) `count` characters from `"string"`. If `count` is greater than the length of `"string"`, the entire string is returned.

## Functional area

String

# Command syntax

## Syntax

|  |
| --- |
| `strRight "string" count` |

### Arguments

| **Name** | **Type** | **Required** | **Comments** |
| --- | --- | --- | --- |
| `string` | string | yes | String to extract sub-string from. |
| `count` | integer | yes | The number of characters to extract from string, counting from the right. |

### Flags

None

## Return value

string

Returns the sub-string from "string"

> Macro (scroll-pagebreak)

## Examples

```plaintext
// Extract some substrings
string $str = "This is some text";
string $subStr;
 
// Extract the last 9 characters
$subStr = `strRight $str 9`;
print $subStr; 
// Should be "some text"
 
// Extract the last 17 characters
$subStr = `strRight $str 17`;
print $subStr; 
// Should be same as $str
```

# Additional information

## Related commands

- [strCompare](https://vicon-help.atlassian.net/wiki/spaces/Shogun112/pages/31228083)
- [strFind](https://vicon-help.atlassian.net/wiki/spaces/Shogun112/pages/31236064)
- [strLeft](https://vicon-help.atlassian.net/wiki/spaces/Shogun112/pages/31232699)
- [strLength](https://vicon-help.atlassian.net/wiki/spaces/Shogun112/pages/31230303)
- [strMid](https://vicon-help.atlassian.net/wiki/spaces/Shogun112/pages/31229178)
- [strReplace](https://vicon-help.atlassian.net/wiki/spaces/Shogun112/pages/31234764)
- [strReverseFind](https://vicon-help.atlassian.net/wiki/spaces/Shogun112/pages/31228001)
- [strTok](https://vicon-help.atlassian.net/wiki/spaces/Shogun112/pages/31230232)
- [strTokArray](https://vicon-help.atlassian.net/wiki/spaces/Shogun112/pages/31238788)