写一个方法String left(String str ,int n) str字符串中可能包含中文,
中文是2bytes,中文是一半时不返回。
实现的功能是如:
str = "中abc12",n = 4,则该方法返回"中ab"
str = "中abc国a",n = 6,则返回"中abc"
写一个方法String left(String str ,int n) str字符串中可能包含中文,
中文是2bytes,中文是一半时不返回。
实现的功能是如:
str = "中abc12",n = 4,则该方法返回"中ab"
str = "中abc国a",n = 6,则返回"中abc"