CString函数 [英] CString functions

查看:57
本文介绍了CString函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想对字符串执行以下操作:


1)检查前四个字符是否为DATA


2)从以下字符串DATA 123 xyz中获取中间的单词。 (

中间词是可变长度) - 提取123。


3)从以下字符串中获取最后一个单词/数字数据发送1467436267


我应该使用哪些功能来实现这一目标?我是C ++的新手,并且发现

字符串操作很棘手。

I want to do the following to strings:

1) Check if first four characters are "DATA"

2) Get the middle ''word'' from the following string "DATA 123 xyz" (the
middle word is variable length) - extract the "123".

3) Get the last word/number from the following string "DATA SEND 1467436267"

What functions should I use to achieve this? I''m new to C++ and finding
string manipulation tricky.

推荐答案



Gareth写道:

Gareth wrote:
我想对字符串进行以下操作:

1)检查前四个字符是否为DATA

2)从以下字符串DATA 123 xyz中获取中间的单词。 (
中间词是可变长度) - 提取123。

3)从以下字符串中获取最后一个单词/数字DATA SEND 1467436267

我应该用什么功能来实现这个目标?我是C ++的新手,并且发现字符串操作很棘手。
I want to do the following to strings:

1) Check if first four characters are "DATA"

2) Get the middle ''word'' from the following string "DATA 123 xyz" (the
middle word is variable length) - extract the "123".

3) Get the last word/number from the following string "DATA SEND 1467436267"

What functions should I use to achieve this? I''m new to C++ and finding
string manipulation tricky.




如果你使用CString,它为此提供了很多设施。看看

at -


CString :: Left

CString :: Mid

CString ::正确

CString ::查找

CString :: Tokenize


问候,


Hugh



If you use CString it provides lots of facilities for this. Have a look
at -

CString::Left
CString::Mid
CString::Right
CString::Find
CString::Tokenize

Regards,

Hugh


Gareth写道:
我想对字符串进行以下操作:
1)检查前四个字符是否为DATA

2)从以下字符串DATA 123 xyz中获取中间的单词。 (
中间词是可变长度) - 提取123。

3)从以下字符串中获取最后一个单词/数字DATA SEND 1467436267

我应该用什么功能来实现这个目标?我是C ++的新手,并且发现字符串操作很棘手。
I want to do the following to strings:

1) Check if first four characters are "DATA"

2) Get the middle ''word'' from the following string "DATA 123 xyz" (the
middle word is variable length) - extract the "123".

3) Get the last word/number from the following string "DATA SEND 1467436267"

What functions should I use to achieve this? I''m new to C++ and finding
string manipulation tricky.




CString不是标准的C ++类。查看microsoft.public。*

newsgrouop for CString。


对于std :: string,请使用:


std :: string :: substr(),

std :: string :: find_first_of()

std :: string :: find_last_of()



CString is not a standard C++ class. Look in a microsoft.public.*
newsgrouop for CString.

For std::string, use :

std::string::substr(),
std::string::find_first_of()
std::string::find_last_of()


" red floyd" <无***** @ here.dude>在留言中写道

news:c8 ***************** @ newssvr29.news.prodigy.ne t ...
"red floyd" <no*****@here.dude> wrote in message
news:c8*****************@newssvr29.news.prodigy.ne t...
CString不是标准的C ++类。查看microsoft.public。*
newsgrouop for CString。
CString is not a standard C++ class. Look in a microsoft.public.*
newsgrouop for CString.




....这是发布到microsoft.public.vc.language和

microsoft.public.vc.mfc我可能会补充说,我们最近想出了CString规则的

结论! :)


-

- Mark Randall
http://zetech.swehli.com


那些认为他们知道一切的人对那些人来说是一个很大的烦恼>
我们的人

Isaac Asimov



.... This is posted to microsoft.public.vc.language and
microsoft.public.vc.mfc where, I might add, we recently came up with the
conclusion that CString rules! :)

--
- Mark Randall
http://zetech.swehli.com

"Those people that think they know everything are a great annoyance to those
of us who do"
Isaac Asimov


这篇关于CString函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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