MCPcopy Create free account
hub / github.com/FuzzAnything/PromptFuzz / strip_code_prefix

Function strip_code_prefix

src/request/openai.rs:299–307  ·  view source on GitHub ↗
(input: &'a str, pat: &str)

Source from the content-addressed store, hash-verified

297
298
299fn strip_code_prefix<'a>(input: &'a str, pat: &str) -> &'a str {
300 let pat = String::from_iter(["```", pat]);
301 if input.starts_with(&pat) {
302 if let Some(p) = input.strip_prefix(&pat) {
303 return p;
304 }
305 }
306 input
307}
308
309/// strip the code wrapper that ChatGPT generated with code.
310fn strip_code_wrapper(input: &str) -> String {

Callers 1

strip_code_wrapperFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected