C#创建的字符串(指定长度) [英] C# String creation (specified length)

查看:1488
本文介绍了C#创建的字符串(指定长度)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有一种简洁的方式(即不是一个for循环)来创建一个指定长度的字符串?无所谓什么是字符串研究。

Is there a succinct way (i.e. not a for loop) to create a string of a specified length? Doesn't matter what is in the string.

推荐答案

您可以使用字符串构造函数,一个字符 INT 。它创建了一个字符串实例与字符重复指定的次数。

You can use the string constructor that takes a char and an int. It creates a string instance with the char repeated the specified number of times.

这篇关于C#创建的字符串(指定长度)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆