C# 字符串按设置的格试在前面或后面增加空格或其它字符
2021-06-05 14:04
标签:return gad str enc else style lse encoding div C# 字符串按设置的格试在前面或后面增加空格或其它字符 标签:return gad str enc else style lse encoding div 原文地址:https://www.cnblogs.com/xiongyunsheng/p/10801442.html 1 public string lengadd(string stringa, string stringb, int count, int mode) //以stringa的长度,未到count的长度则增加stringb,mode属性0是增加前面,1是增加后面
2 {
3 int stringaa = System.Text.Encoding.Default.GetBytes(stringa).Length;
4 if (mode == 0)
5 {
6 for (int i = 1; i )
7 {
8 stringa = stringb + stringa;
9 }
10
11 }
12 else
13 {
14 for (int i = 1; i )
15 {
16 stringa = stringa + stringb;
17 }
18
19 }
20 return stringa;
21 }