MCPcopy Create free account
hub / github.com/AI45Lab/Code / find_balanced_json_array

Function find_balanced_json_array

core/src/llm/structured.rs:366–368  ·  view source on GitHub ↗

Find the first balanced `[...]` substring.

(text: &str)

Source from the content-addressed store, hash-verified

364
365/// Find the first balanced `[...]` substring.
366fn find_balanced_json_array(text: &str) -> Option<&str> {
367 find_balanced(text, '[', ']')
368}
369
370fn find_balanced(text: &str, open: char, close: char) -> Option<&str> {
371 find_balanced_range(text, open, close).map(|(start, end)| &text[start..end])

Callers 1

extract_json_valueFunction · 0.85

Calls 1

find_balancedFunction · 0.85

Tested by

no test coverage detected