java补零方法

xiaoxiao2021-02-28  77

仅提供思路,补其他字符、或左边右补需做相应修改:

public static void main(String[] args) { String s0="00000000"; String sDemo="sb"; String sNew =s0.substring(sDemo.length())+sDemo; System.out.println(sNew); }

转载请注明原文地址: https://www.6miu.com/read-75447.html

最新回复(0)