火急,將一個字符重復n次得到的另一個字符的函數是什麽?

amfer 2003-08-26 04:05:15
UP
...全文
18 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
amfer 2003-08-26
  • 打赏
  • 举报
回复
这么麻烦?举个例子来看嘛。

你看replicate('0',5)="00000"
就这么简单
gfh21cn 2003-08-26
  • 打赏
  • 举报
回复
AnsiStirng t_Str=AnsiString::StringOfChar('a',n);//得到n个a的字符串
COKING 2003-08-26
  • 打赏
  • 举报
回复
memset
netsys2 2003-08-26
  • 打赏
  • 举报
回复
Header File

string.h

Category

Manipulation Routines

Syntax

#include <string.h>
char *strnset(char *s, int ch, size_t n);
wchar_t *_wcsnset(wchar_t *s, wchar_t ch, size_t n);

#include <mbstring.h>
unsigned char *_mbsnset(unsigned char *s, unsigned int ch, size_t n);

Description

Sets a specified number of characters in a string to a given character.

strnset copies the character ch into the first n bytes of the string s. If n > strlen(s), then strlen(s) replaces n. It stops when n characters have been set, or when a null character is found.

Return Value

Each of these functions return s.
amfer 2003-08-26
  • 打赏
  • 举报
回复
表达不准确,应该是:“将一个字符重复n次得到另一个字符串的函数”

就像sql server 里的replicate函数
yhz 2003-08-26
  • 打赏
  • 举报
回复
“將一個字符重復n次”???

什么叫将一个字符重复n次?是不是 memset ?
amfer 2003-08-26
  • 打赏
  • 举报
回复
表達不准確,應該是“將一個字符重復n次得到另一個字符串的函數“

如同SQL Server里的replicate函數

13,825

社区成员

发帖
与我相关
我的任务
社区描述
C++ Builder相关内容讨论区
社区管理员
  • 基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧