如何在字符串之间休息 [英] How to make a break between strings
本文介绍了如何在字符串之间休息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
I have a problem with getting a break between two striges. I use the length () method to read the length of the sring and want the gap between words to be the value obtained from the length () method.
我尝试过:
i try
What I have tried:
i try
int p = s.length();
System.out.print(p+1);
推荐答案
C#:
C#:
string s = "AAAA BB CC";
string[] tokens = s.Split( ' ' );
int l = tokens[ 0 ].Length;
string sep = "".PadRight( l );
s = string.Join( sep, tokens );
Console.WriteLine( s );
Console.ReadKey();
这篇关于如何在字符串之间休息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文