请教在.net 2003合并集合的帮助文档的使用

keasy0220 2004-12-26 10:46:27
在.net 2003合并集合的帮助文档中不能查找像abs的c函数,也没有像CString的类说明,是我没有设置好吗?谢谢!
在msdn2001中可以查找的。
...全文
62 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
kangxidadi 2004-12-27
  • 打赏
  • 举报
回复
Visual C++ 概念:添加功能

基本的 CString 操作请参见
字符串
本文解释基本的 CString 操作,包括:

从标准 C 字符串创建 CString 对象
访问 CString 中的单个字符
串接两个 CString 对象
比较 CString 对象
CString 类提供成员函数和重载运算符,它们可以复制(在某些情况下甚至超越)C 运行时库的字符串服务(例如 strcat)。

从标准 C 字符串创建 CString 对象
可将 C 样式的字符串分配给一个 CString,就像可将一个 CString 对象分配到另一个 CString 对象一样:

将 C 字符串的值分配到 CString 对象:
CString myString = "This is a test";
将一个 CString 的值分配到另一个 CString 对象:
CString oldString = "This is a test";
CString newString = oldString;
将一个 CString 对象分配到另一个 CString 对象时,将复制该 CString 对象的内容。因此,两个字符串不会共享一个对组成字符串的实际字符的引用。有关使用 CString 对象作为值的更多信息,请参见文章 CString 语义。

注意 若要编写应用程序,以便为 Unicode 或 ANSI 对其进行编译,请使用 _T 宏来编写字符串的代码。有关更多信息,请参见文章 Unicode 和多字节字符集 (MBCS) 支持。
访问 CString 中的单个字符
可使用 GetAt 和 SetAt 成员函数来访问 CString 对象中的单个字符。还可使用数组元素、下标、运算符 ( [ ] )(而不是 GetAt)来获取单个字符,这与按索引来访问数组元素相似,正如在标准的 C 样式字符串中那样)。CString 字符的引索值是从零开始的。

并置两个 CString 对象
要并置两个 CString 对象,请使用串联运算符(+ 或 +=),如下所示:

CString s1 = "This "; // Cascading concatenation
s1 += "is a ";
CString s2 = "test";
CString message = s1 + "big " + s2;
// Message contains "This is a big test".
必须至少有一个串联运算符(+ 或 +=)的参数是 CString 对象,但是能够为其他参数使用常数字符串(如 "big")或 char(如“x”)。

比较 CString 对象
Compare 成员函数和 CString 的 == 运算符是等效的。Compare、operator== 和 CompareNoCase 可识别 MBCS 和 Unicode;并且 CompareNoCase 不区分大小写。CString 的 Collate 成员函数区分区域性,并且常常要比 Compare 慢。仅当有必要遵守当前区域指定的排序规则时,才应使用 Collate。

下面的表显示了可用的 CString 比较函数及其在 C 运行时库中等效的可移植 Unicode/MBCS 函数:

CString 函数 MBCS 函数 Unicode 函数
Compare _mbscmp wcscmp
CompareNoCase _mbsicmp _wcsicmp
Collate _mbscoll wcscoll

CString 类重写关系运算符(<,<=,>=,>,== 和 !=)。可使用这些运算符来比较两个 CString,如下所示:

CString s1( "Tom" );
CString s2( "Jerry" );
if( s1 < s2 )
...
请参见
字符串



--------------------------------------------------------------------------------

向 Microsoft 发送有关此主题的反馈

© Microsoft Corporation。保留所有权利。
kangxidadi 2004-12-27
  • 打赏
  • 举报
回复
Run-Time Library Reference

abs, _abs64See Also
Data Conversion Routines | Floating-Point Support | _cabs | fabs | labs | Run-Time Routines and .NET Framework Equivalents
Requirements
Routine Required header Compatibility
abs <stdlib.h> or <math.h> ANSI, Win 98, Win Me, Win NT, Win 2000, Win XP
__abs64 <stdlib.h> Win 98, Win Me, Win NT, Win 2000, Win XP

For additional compatibility information, see Compatibility in the Introduction.

Libraries

All versions of the C run-time libraries.
Calculates the absolute value.

int abs(
int n
);
long abs(
long n
); // C++ only
double abs(
double n
); // C++ only
long double abs(
long double n
); // C++ only
float abs(
float n
); // C++ only
__int64 _abs64(
__int64 n
);
Parameter
n
Integer value.
Return Value
The abs function returns the absolute value of its parameter. There is no error return.

Remarks
C++ allows overloading, so you can call overloads of abs. In a C program, abs always takes and returns an int.

Requirements
Routine Required header Compatibility
abs <stdlib.h> or <math.h> ANSI, Win 98, Win Me, Win NT, Win 2000, Win XP
__abs64 <stdlib.h> Win 98, Win Me, Win NT, Win 2000, Win XP

For additional compatibility information, see Compatibility in the Introduction.

Libraries

All versions of the C run-time libraries.

Example
This program computes and displays the absolute values of several numbers.

// crt_abs.c
#include <stdio.h>
#include <math.h>
#include <stdlib.h>

int main( void )
{
int ix = -4, iy;
long lx = -41567L, ly;
double dx = -3.141593, dy;
__int64 wx = -1, wy;

wy = _abs64( wx );
printf( "The absolute value of %I64x is %I64x\n", wx, wy);

iy = abs( ix );
printf( "The absolute value of %d is %d\n", ix, iy);

ly = labs( lx );
printf( "The absolute value of %ld is %ld\n", lx, ly);

dy = fabs( dx );
printf( "The absolute value of %f is %f\n", dx, dy );
}
Output
The absolute value of ffffffffffffffff is 1
The absolute value of -4 is 4
The absolute value of -41567 is 41567
The absolute value of -3.141593 is 3.141593
See Also
Data Conversion Routines | Floating-Point Support | _cabs | fabs | labs | Run-Time Routines and .NET Framework Equivalents



--------------------------------------------------------------------------------

Send feedback on this topic to Microsoft

© Microsoft Corporation. All rights reserved.
jxzhang615 2004-12-27
  • 打赏
  • 举报
回复
帮顶!

7,765

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 非技术区
社区管理员
  • 非技术区社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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