怎么给java中给字符串中每两位字符加一个空格

  1. String input = "abcdefghijk";
  2. String regex = "(.{2})";
  3. input = input.replaceAll (regex, "$1 ");
  4. System.out.println (input);
腾讯云服务器安全可靠高性能,多种配置供您选择
avatar

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: