public class CodeBlockUtils extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
EMPTY_LINE_REGEX |
static Pattern |
XML_FENCE |
| Constructor and Description |
|---|
CodeBlockUtils() |
| Modifier and Type | Method and Description |
|---|---|
static List<CodeBlock> |
extractCodeBlocks(String text)
提取文本中所有 ``` 开头、``` 结尾的代码块
|
static String |
parseHtml(String generatedText)
Extracts HTML content from the generated text.
|
static String |
parseJavaCode(String generatedText)
Extracts Java code from the generated text.
|
static String |
parseJson(String generatedText)
Extracts JSON content from the generated text.
|
static String |
parsePythonCode(String generatedText) |
static String |
parseTypescriptCode(String generatedText)
Extracts TypeScript code from the generated text.
|
static String |
parseXml(String generatedText)
Extracts XML content from the generated text.
|
public static final Pattern XML_FENCE
public static final String EMPTY_LINE_REGEX
public static String parseJson(String generatedText)
generatedText - the raw text containing JSONpublic static String parseXml(String generatedText)
generatedText - the raw text containing XMLpublic static String parseJavaCode(String generatedText)
generatedText - the raw text containing Java codepublic static String parseHtml(String generatedText)
generatedText - the raw text containing HTMLpublic static String parseTypescriptCode(String generatedText)
generatedText - the raw text containing TypeScript codeCopyright © 2026. All rights reserved.