package com.xly.util; import org.apache.commons.lang3.StringUtils; public class InputPreprocessor { public static String preprocessWithCommons(String userInput) { if (StringUtils.isBlank(userInput)) { return ""; } // normalizeSpace() 已经做了去除首尾空格和合并中间空格 return StringUtils.normalizeSpace(userInput).toLowerCase(); } }