String handling

From NVIDIA-Omniverse/ovrtx · View interactive version

String handling is an AI agent skill from the GitHub repository NVIDIA-Omniverse/ovrtx. Working with ovx_string_t in C and C++. Use when user asks about printing, comparing, or converting ovx strings.

How to use this skill

Skill file

String Handling

When to Use

Use this skill when the user asks about printing, comparing, or converting ovx strings.

Inputs

Resolve inputs in this order: existing repository files and referenced snippets, explicit user request, then broader agent context.

Prerequisites

Instructions

  1. Identify whether the task is printing, comparing, converting, or preserving an ovx_string_t.
  2. Use both ptr and length; do not assume the string can be handled safely by APIs that only look for a null terminator.
  3. In C, print with a precision-limited string format and compare by checking length before using strncmp.
  4. In C++, prefer std::string_view when the caller only needs borrowed access, and copy immediately if the value must outlive the API-owned storage.
  5. When changing code, run the C example or helper test that owns the referenced string-handling pattern whenever practical.

Output Format

Scripts

This skill has no scripts.

Limitations

Overview

All strings returned by the ovrtx API use ovx_string_t — a (ptr, length) pair. The strings are null-terminated, but prefer using the length field over relying on the null terminator.

C

Print with the %.*s precision pattern so the explicit length controls how many

characters are read from ptr.

Compare by checking length first, then using strncmp for the exact byte count.

C++

Wrap ptr and length in std::string_view for zero-copy access to the

standard string API.

The error-handling helper in the minimal C example demonstrates this pattern:

Source: examples/c/minimal/main.cpp snippet check-error-helper

Key Types / Functions

| Type | Header |

|------|--------|

| ovx_string_t | include/ovx/types.h |

| literal_to_ovx_string(str) | include/ovx/types.h — creates ovx_string_t from a string literal |

| is_ovx_string_empty(str) | include/ovx/types.h — null/empty check |

Troubleshooting

References

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.