记得上下班打卡 | git大法好,push需谨慎

Commit d07274e4 authored by wangyifan's avatar wangyifan

支付文案特殊符号替换

parent f3ebbe9e
......@@ -42,11 +42,15 @@ public class PaySubjectUtils {
// 替换所有不符合的字符为 -
String cleaned = pattern.matcher(subject).replaceAll("-");
// 4. 显式移除易混淆的“竖线类”字符(即使它们是汉字或全角符号)
cleaned = cleaned.replace("丨", "-") // U+4E28: CJK 汉字(部首),支付宝可能拦截
.replace("|", "-"); // U+FF5C: 全角竖线,支付宝明确不友好
// 处理多个连续的 - 替换为单个 -
cleaned = cleaned.replaceAll("-+", "-");
// 去除首尾的 -(保留空格)
cleaned = cleaned.replaceAll("^-|-$", "");
cleaned = cleaned.replaceAll("^-+|-+$", "");
return "正在现场-" + cleaned;
}catch (Exception e){
......@@ -116,7 +120,7 @@ public class PaySubjectUtils {
public static void main(String[] args) {
String text = "「发呆的下午」| 北京的第一次“发呆冲击” 鸟撞x虎啸春x大叫控";
String text2 = "大波浪乐队 2021全新专辑《新逻辑 不止一面》全国巡演郑州";
String text2 = "Don't \"mid way\" 「独 步」【了】丨 ·广州站";
String text3 = "Matt吕彦良2025-Fresh-ME-新鲜之旅巡演-Refresh-with-Matt-Lv-长沙站Matt吕彦良2025-Fresh-ME-新鲜之旅巡演-Refr鲜之旅鲜之旅鲜之旅鲜之旅鲜之旅鲜之旅鲜之旅鲜之旅鲜之旅鲜之旅鲜之旅鲜之旅";
System.out.println(cleanSubject(text));
System.out.println(cleanSubject(text2));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment