mirror of
https://github.com/barsdeveloper/ueblueprint.git
synced 2026-02-03 23:55:04 +08:00
Grammar move to regex WIP
This commit is contained in:
@@ -293,17 +293,21 @@ export default class Utility {
|
||||
}
|
||||
|
||||
/** @param {String} value */
|
||||
static escapeString(value, input = false) {
|
||||
static escapeString(value) {
|
||||
return value
|
||||
.replaceAll('\\', '\\\\') // Escape \
|
||||
.replaceAll('"', '\\"') // Escape "
|
||||
.replaceAll("\n", "\\n") // Replace newline with \n
|
||||
.replaceAll("\t", "\\t") // Replace tab with \t
|
||||
}
|
||||
|
||||
/** @param {String} value */
|
||||
static unescapeString(value, input = false) {
|
||||
static unescapeString(value) {
|
||||
return value
|
||||
.replaceAll('\\"', '"')
|
||||
.replaceAll("\\n", "\n")
|
||||
.replaceAll("\\t", "\t") // Replace tab with \t
|
||||
.replaceAll("\\n", "\n") // Replace newline with \n
|
||||
.replaceAll('\\"', '"') // Escape "
|
||||
.replaceAll('\\\\', '\\') // Escape \
|
||||
}
|
||||
|
||||
/** @param {String} value */
|
||||
|
||||
Reference in New Issue
Block a user