将char *转换为大写 [英] Convert char* to upper case

查看:323
本文介绍了将char *转换为大写的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




出于某种原因,我在周五早上消隐了。我有一个类

构造函数调用Point如下所示。在我设置成员

变量之前,试图弄清楚我是如何使用
使参数全部大写传递。


感谢您的见解。


RishiD


Point(const char * name,

const char * description,

const char * iomid,

const char *地址,

const char *类型,

事件*事件)

{

m_strName = name;

m_strDesc = description;

m_strAddress = address;

m_strType = type;

m_strParentName = iomid;

m_Event = event;

}

解决方案

RishiD< ri **** @ gmail.comwrote:


出于某种原因,我是这周五早上消隐。



从发布看起来有点像C ++的代码到

comp.lang.c开始? (这确实是一个漫长的一周。)


我有一个类

构造函数调用Point如下所示。在我设置成员

变量之前,试图弄清楚我如何能够使用大写字母传递全部大写的参数。



这里没有内置的C函数,但你可以使用内置的toupper()为字符写一个

。或者,如果你确实正在编写C ++,那么

可能是一种C ++方式来实现它。

似乎。


-

C. Benson Manica |我*应该*知道我在说什么 - 如果我

cbmanica(at)gmail.com |不,我需要知道。火焰欢迎。


RishiD说:





由于某种原因,我在这个星期五早上消隐。我有一个类

构造函数调用Point如下所示。



....这让我觉得你正在使用C ++,所以我已经交叉发布了这个

回复comp.lang.c ++,并为该组设置后续跟踪。


试图弄清楚我怎么能

使所有参数都通过我设置成员之前的大写

变量。



在C中,你可能会写一个在循环中调用toupper()的函数 -

但在C ++中可能会有更多的C ++方法。


[保留文章的剩余部分,为了方便clc ++。大家好,

好​​久不见。]


>

感谢您的见解。 />

RishiD


Point(const char * name,

const char * description,

const char * iomid,

const char *地址,

const char *类型,

事件*事件)

{

m_strName = name;

m_strDesc = description;

m_strAddress = address;

m_strType = type ;

m_strParentName = iomid;

m_Event = event;

}



-

Richard Heathfield

Usenet是一个奇怪的地方 - dmr 29/7/1999
http://www.cpax.org.uk

电子邮件:rjh在上述域名中, - www。


Christopher Benson-Manica写道:


> RishiD< ri **** @ gmail.comwrote:


>> ...尝试弄清楚如何在设置成员
变量之前使参数以全部大写形式传递。


没有内置C函数可以做到这一点,但你可以使用内置toupper()为字符写一个
。或者,如果您确实正在编写C ++,那么
可能是一种C ++方式来实现这一点。



[OT]令人惊讶的是,toupper(c)或toupper(开始,结束)

提供的服务< ctype>


Roberto Waltman


[请回复群组,

返回地址无效]


Hi,

For some reason I am blanking this Friday morning. I have a class
constructor call Point as shown below. Trying to figure out how I can
make the arguments passed in all upper case before I set the member
variables.

Thanks for the insight.

RishiD

Point(const char* name,
const char* description,
const char* iomid,
const char* address,
const char* type,
Event* event)
{
m_strName = name;
m_strDesc = description;
m_strAddress = address;
m_strType = type;
m_strParentName = iomid;
m_Event = event;
}

解决方案

RishiD <ri****@gmail.comwrote:

For some reason I am blanking this Friday morning.

Starting with posting code that seems a little like C++ to
comp.lang.c? (It has indeed been a lengthy week.)

I have a class
constructor call Point as shown below. Trying to figure out how I can
make the arguments passed in all upper case before I set the member
variables.

There''s no builtin C function to do this, but you could write one
using the builtin toupper() for characters. Alternatively, there
might be a C++ way to do this, if you are indeed writing C++ as it
seems.

--
C. Benson Manica | I *should* know what I''m talking about - if I
cbmanica(at)gmail.com | don''t, I need to know. Flames welcome.


RishiD said:

Hi,

For some reason I am blanking this Friday morning. I have a class
constructor call Point as shown below.

....which makes me think you''re using C++, so I''ve cross-posted this
reply to comp.lang.c++, and set followups to that group.

Trying to figure out how I can
make the arguments passed in all upper case before I set the member
variables.

In C, you''d probably write a function that calls toupper() in a loop -
but in C++ there may be a more C++y way to do it.

[Remainder of your article retained, for clc++''s convenience. Hi guys,
long time no see.]

>
Thanks for the insight.

RishiD

Point(const char* name,
const char* description,
const char* iomid,
const char* address,
const char* type,
Event* event)
{
m_strName = name;
m_strDesc = description;
m_strAddress = address;
m_strType = type;
m_strParentName = iomid;
m_Event = event;
}

--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at the above domain, - www.


Christopher Benson-Manica wrote:

>RishiD <ri****@gmail.comwrote:

>>... Trying to figure out how I can
make the arguments passed in all upper case before I set the member
variables.


There''s no builtin C function to do this, but you could write one
using the builtin toupper() for characters. Alternatively, there
might be a C++ way to do this, if you are indeed writing C++ as it
seems.

[OT] That would be, surprisingly, the toupper(c) or toupper(begin,end)
services provided in <ctype>

Roberto Waltman

[ Please reply to the group,
return address is invalid ]


这篇关于将char *转换为大写的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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