Houdini 22.0 Nodes APEX nodes

string::Slice

Extracts a slice from a string.

On this page
Since 22.0

Extracts a slice from a string between the start and end indices, given a step size. The character at the end index is not included in the result.

Tip

A start or end value of -n indexes the nth last character of the string.

Inputs

string: String

The input string.

usestart: Bool

If set to True, uses the start index. If set to False and step is positive, the slice starts at the beginning of string. If set to False and step is negative, the slice starts at the end of string - 1.

start: Int

The index of the first character in string to add to the slice. If negative, the length of string is added to start.

useend: Bool

If set to True, uses the end index. If set to False and step is positive, the slice stops at the end of string. If set to False and step is negative, the slice stops at the beginnning of string (steps backward to the beginning of string).

end: Int

The end index of the slice. The slice stops one index before it reaches end. If negative, the length of string is added to end.

Note

If end is 0 and step is negative, the first character of string is excluded from the result.

If end is -1 and step is negative, an empty string is returned. In this case, it is recomended instead to set useend to False.

step: Int

The increment between indices of characters in string to include in the result. Defaults to 1. For example, if step is 2, the result includes every second character in string. If step is negative, start must be greater than end.

Outputs

result: String

The slice extracted from the input string.

See also

APEX nodes