2010年3月2日 星期二

CString:: right && CString ::left 用法

CString Left(int nCount)

Parameters

nCount
Specifies the number of characters to extract from this CString object.

Return Value

A CString object containing a copy of the specified range of characters. Note that the returned CString object may be empty.

Example

The following example demonstrates the use of CString::Left.

// example for CString::Left CString s(_T("abcdef")); ASSERT(s.Left(2) == _T("ab"));
left和right的用法是相同的
只是算個數的方向不同
left - 是從左數到右
right - 是從右數到左

CString cs = _T("abcdef");
字串.left(個數) =>ex. cs.left(2) = _T("ab");
字串.right(個數) =>ex. cs.right(2) = _T("ef");

沒有留言:

張貼留言