MFC CString 用法小结

MFC CString 用法小结
MFC CString 用法小结

MFC CString 用法小结

1. 初始化方法:

(1) 直接复制,如Cstring=”mingrisoft”;

(2) 通过构造函数初始化,如CString str(… ?,100)//与分配100个字节,填充空格

char* p=”feiqiang”; Cstring(p);delete p.

(3) 加载工程中的字符串资源,如CString str;str.LoadString(IDS_STR);

(4) 使用CString类的成员函数Format初始化,如CString str; int i=0; str.Format(“value:%d”,i);

2. 将CString转化为char*,如

CString str=”feqiang”;

char *p;

p=str.GetBuffer();

delete p;

将char*转化为CString,如:

char* p=”feiqiang”;

p[len(p)]=?\0?;

Cstring str(p);

char* 和char数组的转化:

char buf[5] ={…a?,?b?,?c?};

char *p;

p=new char[5];

p=buf;

将字符串转化为数字:

CString str=”12”;

int i=atoi(str);

long j=atoll(str);

float f=atof(str);

将数字转化为字符串:

CString str;

int i=12;

str.Format(“%d”,i);

long j=12;

str,Format(“%ld”,j);

同理其他类型。

3. 字符串的相关操作即方法的使用:

(1) 提取字符串中的中文,如

CString strtext,temp,strres;

GetLlgItem(IDC_TEXT)->GetWindowText(strtext);//通过ID获取编辑框中的文本

for(int =\0;i

char ch=strtext.GetAt(i);

if(IsDBCSLeadByte(ch)){ //判断字符是否是双字节编码的前一个字节

tmp=strtext.Mid(i,2);//截取索引index1到index2的字符[ )

i++;

stress+=tmp;

}

GetLlgItem(IDC_RESULT)->SetWindowText(strtes);//设置文本框中的文本

}

(2) 英文字符串首字母大写,如将以空格符分隔的英文单词的第一个字母大写(小写)

str.GetAt(i);//提取字符串索引为i个字母

str.MakeLower();//转化为小写

tmp.MakeUpper();//转化为大写

(2) 按制定符号分割字符:

int pos=str.Find(strchar);//查找字符,如果没找到,则返回0,找到则返回字符的位置,参数可以是字符也可以是字符串

while(pos>0){

str1=str.Left(pos);//取左,参数为字符串的个数

str=str.Right(str.GetLength-pos-1);//取右,参数同上

tmp.Format(“%s\r\n”,str1);//字符串中\r\n代表回车化行符

strres+=tmp;

pos=str.Find(strchar);

}

(3) 删除指定的中文:

m_text.GetWindowText(strtxt);

m_text.GetSel(istart,iend);//得到文本框中选中的文本,并且得到文本的头索引和尾索引

if(istart==iend){

return;

}

str1=strtxt.Left(istart);

if(iend>=strtxt.GetLength()){

str2=””;

}else{

str2=strtxt.Right(strtxt.GetLength()-iend);

}

strres+=str1;

strres+=str2;

(4) 替换字符串:

strtxt.Replace(strchar,strnew);//用新串替换旧串

(5) 根据CPoint查找位置:

CPoint pt;//获取字符串时获取鼠标所在字符串的位置

int pos=m_text.CharFromPos(pt);//根据pt获取字符串中的位置,即其左侧字符的位置if(str.IsEmpty()){//判断字符串是否为空

m_num.AddString(strres);//文本框追加字符串

}

将字符转化为大写:ch=ch-32;

(6) 字符串忽略大小写的比较:

CString str=”feiqiang”;

int com=https://www.360docs.net/doc/8010727543.html,pareNoCa se(“mingri”);//如果相等返回0,否则返回-1;

(7) 连接换行符:CString str=”feiqiang\

t”;

(8) 字符反转:str.MakeReverse();

(9) 取出首位空格:str.TrimLeft(); str.TrimRight();

取出字符串中的所有空格,str.Replace(“ ”,””);

(10) 在ListBox中查找字符串

int index=::SendMessage(m_stringlist.GetSafeHwnd(),LB_FINDSTRINGEXACT,-1, (LPARAM)(LPCTSTR)strtext));//通过SendMessage函数向列表控件发送LB_FINDSTRINGEXACT消息来查找指定字符串是否在列表空间中,如果存在则返回索引位置。

(11) 字符串数组:

CString str[5] array;

CString str[5]={“feiqiang”,”mingri”,”mr”};

for(int i=0;i<5;i++){

array.Add(str[i]);//添加元素

}

for(int j=0;j

if(array.Get(j)==”mr”){

MessageBox(“存在”);

}

}

(12) 设置编码方式:Project/SettingsàPreprocessor,如果要使用DBCS,则添加_MBCS(多个字节编码),如果要使用Unicode,则添加_Unicode,不添加则使用ASCII.

二字符串指针类型

(1) LPCSTR:32位静态字符串指针,可以直接赋值使用,如LPCSTR str=”mingrisofg”;

(2) LPSTR:32位字符串指针,如LPSTR str; str=new char[256];

(3) LPCTSTR:32位UNICODE型静态字符串指针,如LPCTSTR str=_T(“mingrisoft”);

(4) LPTSTR: 32位UNICODE型字符串指针,如LPTSTR str=new TCHAR[256];

三BSTR(进行COM编程时使用的字符串类型)与CString之间的转化:

1. 对BSTR变量赋值时:

BSTR bstr=NULL;

bstr=SysAllocString(L”feiqang”);//从LPCWSTR构造

SysFreeString(bstr);//释放

将BSTR强制转化为CString,如:

CString str=(CString) bstr;或CString str; BSTR bstr=str.AllocSysString();

2. _bstr_(对BSTR的包装类),包含的头文件为:”COMDEF.H”

用法:

直接赋值:_bstr_t tbstr=”feqiang”;

给CString对象赋值:CString str=(LPCSTR)tbstr;//LPCSTR str=tbstr;

将_bsr_转化为BSTR,使用copy函数:BSTR bstr=tbstr.copy(); SysFreeString(bstr);

BSTR之间赋值给_bstr_对象,如BSTR bstr=SysAllocString(L”mingri”); _bstr_t

tbstr=bstr;

四格式化类型

如:获取并且格式化系统时间

CTime t=CTime::GetCurrentTime();

CSTring strtime=t.Fo rmat(“%H:%M:%S”);

MessageBox(strtime;

1.CString::IsEmpty

BOOL IsEmpty( ) const;

返回值:如果CString 对象的长度为0,则返回非零值;否则返回0。

说明:此成员函数用来测试一个CString 对象是否是空的。

示例:

下面的例子说明了如何使用CString::IsEmpty。

// CString::IsEmpty 示例

CString s;

ASSERT( s.IsEmpty() );

请参阅CString::GetLength

2.CString::Left

CString Left( int nCount ) const;

throw( CMemoryException );

返回值:返回的字符串是前nCount个字符。

示例:

CString s( _T("abcdef") );

ASSERT( s.Left(2) == _T("ab") );

3.CString::LoadString

BOOL LoadString( UINT nID );

throw( CMemoryException );

返回值:如果加载资源成功则返回非零值;否则返回0。

nID 一个Windows 字符串资源ID。

说明:此成员函数用来读取一个由nID 标识的Windows 字符串资源,并放入一个已有CString 对象中。

示例:

下面的例子说明了如何使用CString::LoadString。

// CString::LoadString 示例

#define IDS_FILENOTFOUND 1

CString s;

if (! s.LoadString( IDS_FILENOTFOUND ))

4.CString::MakeLower

void MakeLower( ); //改变字符的小写

5.CString::MakeReverse

void MakeReverse( ); //字符倒置

6.CString::MakeUpper

void MakeUpper( ); //改变字符的大写

7.CString::Mid

CString Mid( int nFirst ) const;

CString Mid( int nFirst, int nCount ) const;

nCount代表要提取的字符数, nFirst代表要提取的开始索引位置

示例:

CString s( _T("abcdef") );

ASSERT( s.Mid( 2, 3 ) == _T("cde") );

8.CString::ReleaseBuffer

void ReleaseBuffer( int nNewLength = -1 );

参数:nNewLength

此字符串的以字符数表示的新长度,不计算结尾的空字符。如果这个字

符串是以空字符结尾的,则参数的缺省值-1 将把CString 的大小设置为

字符串的当前长度。

说明:

使用ReleaseBuffer 来结束对由GetBuffer 分配的缓冲区的使用。如果你知道缓

冲区中的字符串是以空字符结尾的,则可以省略nNewLength 参数。如果字符

串不是以空字符结尾的,则可以使用nNewLength 指定字符串的长度。在调用ReleaseBuffer 或其它CString 操作之后,由GetBuffer 返回的地址是无效的。

示例:

下面的例子说明了如何使用CString::ReleaseBuffer。

// CString::ReleaseBuffer 示例

CString s;

s = "abc";

LPTSTR p = s.GetBuffer( 1024 );

strcpy(p, "abc"); // 直接使用该缓冲区

ASSERT( s.GetLength() == 3 ); // 字符串长度= 3

s.ReleaseBuffer(); // 释放多余的内存,现在p 无效。

ASSERT( s.GetLength() == 3 ); // 长度仍然是3

9.CString::Remove

int CString::Remove ( TCHAR ch );

返回值:返回从字符串中移走的字符数。如果字符串没有改变则返回零。

参数:ch 要从一个字符串中移走的字符。

说明:此成员函数用来将ch 实例从字符串中移走。与这个字符的比较是区分大小写的。

示例:

// 从一个句子中移走小写字母'c':

CString str (“This is a test.”);

int n = str.Remove( 't' );

ASSERT( n == 2 );

ASSERT( str ==“This is a es. ” );

10.CString::Replace

int Replace( TCHAR chOld, TCHAR chNew );

int Replace( LPCTSTR lpszOld, LPCTSTR lpszNew );

返回值:返回被替换的字符数。如果这个字符串没有改变则返回零。

参数:chOld 要被chNew 替换的字符。

chNew 要用来替换chOld 的字符。

lpszOld 一个指向字符串的指针,该字符串包含了要被lpszNew 替换的字符。LpszNew 一个指向字符串的指针,该字符串包含了要用来替换lpszOld 的字符。

说明:此成员函数用一个字符替换另一个字符。函数的第一个原形在字符串中用chNew 现场替换chOld。函数的第二个原形用lpszNew 指定的字符串替换lpszOld 指定

的子串。

在替换之后,该字符串有可能增长或缩短;那是因为lpszNew 和lpszOld 的长度

不需要是相等的。两种版本形式都进行区分大小写的匹配。

示例:

// 第一个例子,old 和new 具有相同的长度。

CString strZap( “C - -” );

int n = strZap.Replace('-', '+' );

ASSERT( n == 2 );

ASSERT(strZap == “C++” );

// 第二个例子,old 和new 具有不同的长度。

CString strBang( “Everybody likes ice hockey” );

n = strBang.Replace( “hockey”, “golf” );

ASSERT( n ==1 );

n = strBang.Replace ( “likes” , “plays” );

ASSERT( n == 1 );

n = strBang.Replace( “ice”, NULL );

ASSERT( n == 1 );

ASSERT( strBang == “Everybody plays golg” );

// 注意,现在在你的句子中有了一个额外的空格。

// 要移走这个额外的空格,可以将它包括在要被替换的字符串中,例如,“ice ”。

11.CString::ReverseFind

int ReverseFind( TCHAR ch ) const;

返回值: 返回此CString 对象中与要求的字符匹配的最后一个字符的索引;如果没有找到需要的字符则返回-1。

参数: ch 要搜索的字符。

说明:此成员函数在此CString 对象中搜索与一个子串匹配的最后一个字符。此函数

类似于运行时函数strrchr。

示例:

// CString::ReverseFind 示例

CString s( "abcabc" );

ASSERT( s.ReverseFind( 'b' ) == 4 );

12.CString::Right

CString Right( int nCount ) const;

throw( CMemoryException );

返回值:返回的字符串是最后nCount个字符。

CString s( _T("abcdef") );

ASSERT( s.Right(2) == _T("ef") );

13.CString:: SetAt

void SetAt( int nIndex, TCHAR ch );

说明:可以把字符串理解为一个数组,SetAt类似于[].注意nIndex的范围,如果不合适会有调试错误。Ch 更替字符, 把nIndex位置上的字符变成ch

示例:

CString s( "abc" );

s.MakeReverse();

ASSERT( s == "cba" );

14.CString::TrimLeft

void TrimLeft( );

void CString::TrimLeft( TCHAR chTarget );

说明:如果没有参数,从左删除字符(\n\t空格等),至到遇到一个非此类字符. 当然你也可以指定删除那些字符. 如果指定的参数是字符串,那么遇上其中的一个字符就删除.

\n 换行符

\t TAB字符

示例1:

CString str = "\n\t a";

str.TrimLeft();

str为“a”;

示例2:

CString str = "abbcadbabcadb ";

str.TrimLeft("ab");

结果"cadbabcadb "

str.TrimLeft("ac");

结果"bcadbabcadb "

15.CString::TrimRight

void TrimRight( );

void CString::TrimRight( TCHAR chTarget );

void CString::TrimRight( LPCTSTR lpszTargets );

说明:用法类似于上面。

16.CString::Compare

int Compare( LPCTSTR lpsz ) const;

返回值:字符串一样返回0,小于lpsz 返回-1,大于lpsz 返回1, 区分大小字符

示例:

CString s1( "abc" );

CString s2( "abd" );

ASSERT( https://www.360docs.net/doc/8010727543.html,pare( s2 ) == -1 );

ASSERT( https://www.360docs.net/doc/8010727543.html,pare( "abe" ) == -1

17.CString::CompareNoCase

int CompareNoCase( LPCTSTR lpsz ) const;

返回值:字符串一样返回0,小于lpsz 返回-1,大于lpsz 返回1,不区分大小字符

18.CString::Collate

int Collate( LPCTSTR lpsz ) const;

同CString::Compare

19.CString::CollateNoCase

int CollateNocase( LPCTSTR lpsz ) const;

同CString::CompareNoCase

20.CString::CString //构造函数

CString( );

CString( const CString& stringSrc );

CString( TCHAR ch, int nRepeat = 1 );

CString( LPCTSTR lpch, int nLength );

CString( const unsigned char* psz );

CString( LPCWSTR lpsz );

CString( LPCSTR lpsz );

示例:

CString s1;

CString s2( "cat" );

CString s3 = s2;

CString s4( s2 + " " + s3 );

CString s5( 'x' ); // s5 = "x"

CString s6( 'x', 6 ); // s6 = "xxxxxx"

CString s7((LPCSTR)ID_FILE_NEW); // s7 = "Create a new document"

CString city = "Philadelphia";

21.CString::Delete

int Delete( int nIndex, int nCount = 1);

返回值:是被删除前的字符串的长度

nIndex是第一个被删除的字符,nCount是一次删除几个字符。根据我实验得出的结果:当nCount>要删除字符串的最大长度(GetCount() - nIndex)时会出错,当nCount过大,没有足够的字符删除时,此函数不执行。

示例:

CString str1,str2,str3;

char a;

str1 = "nihao";

str2 = "nIhao";

int x;

// int i=(str1 == str2);

str1.Delete(2,3);

如果nCount(3) > GetCount() – nIndex (5-2)就会执行错误

22.CString::Empty

V oid Empty( );

返回值:没有返回值清空操作;

示例:

CString s( "abc" );

s.Empty();

ASSERT( s.GetLength( ) == 0 );

23.CString::Find

int Find( TCHAR ch ) const;

int Find( LPCTSTR lpszSub ) const;

int Find( TCHAR ch, int nStart ) const;

int Find( LPCTSTR lpszSub, int nStart ) const;

返回值: 不匹配的话返回-1; 索引以0 开始; nStar 代表以索引值nStart 的字符开始搜索, 即为包含以索引nStart字符后的字符串.

示例:

CString s( "abcdef" );

ASSERT( s.Find( 'c' ) == 2 );

ASSERT( s.Find( "de" ) == 3 );

Cstring str(“The stars are aligned”);

Ing n = str.Find('e',5);

ASSERT(n == 12)

24.CString::FindOneOf

int FindOneOf( LPCTSTR lpszCharSet ) const;

返回值: 不匹配的话返回-1; 索引以0 开始

注意::返回此字符串中第一个在lpszCharSet中也包括字符并且从零开始的索引值

示例:

CString s( "abcdef" );

ASSERT( s.FindOneOf( "xd" ) == 3 ); // 'd' is first match.

25.CString::Format

void Format( LPCTSTR lpszFormat, ... );

void Format( UINT nFormatID, ... );

参数:lpszFormat 一个格式控制字符串

nFormatID 字符串标识符

示例:

CString str;

Str.Format(“%d”,13);

此时Str为13

26.CString::GetAt

TCHAR GetAt( int nIndex ) const;

返回值:返回标号为nIndex的字符,你可以把字符串理解为一个数组,GetAt类似于[].注意nIndex的范围,如果不合适会有调试错误。

27.CString::GetBuffer

LPTSTR GetBuffer( int nMinBufLength );

返回值:一个指向对象的(以空字符结尾的)字符缓冲区的LPTSTR 指针。

参数:nMinBufLength

字符缓冲区的以字符数表示的最小容量。这个值不包括一个结尾的空字符的空间。

说明:此成员函数返回一个指向CString 对象的内部字符缓冲区的指针。返回的LPTSTR 不是const,因此可以允许直接修改CString 的内容。如果你使用由GetBuffer 返回的指针来改变字符串的内容,你必须在使用其它的CString 成员函数之前调用ReleaseBuffer 函数。

在调用ReleaseBuffer 之后,由GetBuffer 返回的地址也许就无效了,因为其它的CString 操作可能会导致CString 缓冲区被重新分配。如果你没有改变此CString 的长度,则缓冲区不会被重新分配。当此CString 对象被销毁时,其缓冲区内存将被自动释放。

注意:如果你自己知道字符串的长度,则你不应该添加结尾的空字符。但是,当你用ReleaseBuffer 来释放该缓冲区时,你必须指定最后的字符串长度。如果你添加了结尾的空字符,你应该给ReleaseBuffer 的长度参数传递-1 ,ReleaseBuffer 将对该缓冲区执行strlen 来确定它的长度。

示例:

// CString::GetBuffer 例子

CString s( "abcd" );

#ifdef _DEBUG

afxDump << "CString s " << s << "\n";

#endif

LPTSTR p = s.GetBuffer( 10 );

strcpy( p, "Hello" ); // 直接访问CString 对象。

s.ReleaseBuffer( );

#ifdef _DEBUG

afxDump << "CString s " << s << "\n";

#endif

28.CString::GetLength

int GetLength( ) const;

返回值:返回字符串中的字节计数。

说明:此成员函数用来获取这个CString 对象中的字节计数。这个计数不包括结尾的空字符。对于多字节字符集(MBCS),GetLength 按每一个8 位字符计数;即,在一个多字节字符中的开始和结尾字节被算作两个字节。

示例

下面的例子说明了如何使用CString::GetLength。

// CString::GetLength 示例

CString s( "abcdef" );

ASSERT( s.GetLength() == 6 );

29.CString::Insert

int Insert( int nIndex, TCHAR ch );

int Insert( int nIndex, LPCTSTR pstr );

返回值:返回修改后的长度,nIndex是字符(或字符串)插入后的索引号例子示例:

CString str( “HockeyBest”);

int n = str.Insert( 6, “is” );

ASSERT( n == str.GetLength( ) );

printf( “1: %s\n”, ( LPCTSTR ) str );

n = str.Insert( 6, ' ' );

ASSERT( n == str.GetLength( ) );

printf ( “2: %s\n”, (LPCTSTR) STR );

n = str.Insert(555, …1?);

ASSERT( n == str.GetLength ( ) );

printf ( “3: %s\n”, ( LPCTSTR ) str );

输出

1. Hockeyis Best

2. Hockey is Best

3. Hockey is Best!

过去完成时态用法小结

过去完成时态的用法小结 默认分类2009-12-27 12:54:52 阅读281 评论0 字号:大中小订阅 一、过去完成时适用场合 1. 过去完成时表示在过去某一时间或动作以前已经完成了的动作。这个过去的时间常用by,before等介词短语或一个时间状语从句表示,也可以暗含在上下文中。 I had finished my homework before supper.我在晚饭前就把作业做完了。 The play had already started when we got to the theatre. 我们到剧场时戏已经开始了。 By the end of June they had treated over 10,000 patients. 到六月底他们已经治疗了一万多病人。 2. 过去完成时还可表示过去某一时刻之前发生的动作或状态持续到过去某个时间或还要持续下去,常与for,since等词连用。如: He had served in the army for ten years before he retired last year. 他在部队干了十年,去年退役了。 He told me that he had known her since he was a child. 他告诉我他从小就认识她。 He had learned English for eight years before he went to England for further study. 他在去英国深造前,已学了八年英语。 3. 在一段情景连贯的文字中,先发生的事放在后面叙述时,要用过去完成时。如: Tom flew home, but his father had already died. 汤姆乘飞机回家,他的父亲却已经去世了。4. 过去完成时也用于hardly...when..., no sooner...than..., It was the first time + that分句等一些固定句型中。 He had no sooner left the room than they began to talk about him. 他刚离开房间,他们就议论起他来。 We had hardly begun when we were told to stop. 我们刚开始就被叫停。 It was the first time that he had ever spoken to me in such a tune.他用这样的语调跟我讲话,这是第一次。 二、过去完成时与一般过去时的比较 1. 当一个由before, after, as soon as 等连词引导的从句所表示的动作和主句的动作紧接着发生时,两个动作均可用一般过去时来表示。 We had breakfast after we did morning exercises. 做完早操后,我们吃早饭。 The train started to move just before he reached the platform. 他到月台时火车刚开走。 They started ploughing as soon as they got to the fields. 他们一到地里就开始耕地。 2. 按时间顺序叙述两个或两个以上接连发生的动作时,用一般过去时。 He entered the room, turned on the light and sat down at the table. 他走进屋子,打开灯,坐在桌子旁。 3. 在表示某人过去未曾完成的“心愿”、“打算”、“计划”、“想法”、“许诺”等时,hope, mean, plan, think, intend等谓语动词常用过去完成时。 I had hoped to be back last night, but I didn’t catch the train. 我本来希望昨晚回来的,但没搭上火车。 We had thought to return early but they wouldn’t let us go. 我们本想早回来的,但他们不让我们走。 4. 在表示过去的句子中出现常与完成时态连用的词,如:already,yet,since,for,ever,never及次数名词等时,常用过去完成时来表示。

一般将来时的用法

一般将来时 一、基本内容 1.构成:“助动词will+ 动词原形” 2.含义及用法:一般将来时表示将来某个时间将要发生的动作或存在的状态,也表示将来经常或反复发生的动作。 3.时间状语:一般将来时常与表示将来的时间状语连用,如:tomorrow, next week, next year, in the future等。 Eg: They will visit Shanghai next week. People will have robots in their homes in the future. 二、句型转化 1、肯定句:“主语+will +动词原形+其他。” Eg: They will have a test next week. 2、否定句:在will 后加 not , 即“主语+won't +动词原形+其他。”

Eg: She will be an engineer.(改为否定句) She won't be an engineer. 3、一般疑问句:将will提到主语前面, 即“Will+ 主语+动词原形+其他?” 回答时使用yes/no. Eg: He will live in New York in 10 years. (改为一般疑问句并作肯定回答) Will he live in New York in 10 years? Yes, he will. 三、注意事项 1、Will 常表示客观的将来,也可表示“带意愿色彩的将来”,也可表示“委婉客 气的邀请或命令” Eg: He will be 18 years olds next month.下个月他将满18岁。 I will tell you all about it. 我愿意把所有与此相关的事都告诉你。 Will you please close the door? 请你把门关上好吗? 2、在疑问句中,主语为第一人称(I 和

一般将来时用法及专项练习

一般将来时用法及专项练习 一、一般将来时的动词形式 一般将来时表示将来某个时间将要发生的动作或存在的状态,也表示将来经常或反复发生的动作。一般将来时由助动词shall或will加动词原形构成,shall用于第一人称,will用于第二、三人称。但是现在第一人称一般也用will,其区别并不明显。(或“be going to + 动词原形)常与tomorrow, next… , in (the)future,soon, in five days,in two weeks等连用。 如: I shall not come if it rains tomorrow.如明天下雨我就不来。 My father will leave for China next week.我的爸爸下星期要到中国去。 “I’ll, You’ll, He’ll , She’ll , It’ll, We’ll , They’ll …”是简缩形式。二.一般将来时的句型 1.肯定句:主语+shall /will+动词+其他成份 The workers will build a new school here next year.工人们明年将在这儿盖一所新学校。 They will go shopping this afternoon. 今天下午他们将要去购物。 We shall have a delicious dinner tonight. 今晚我们将美餐一顿。 We shall be there before dark. 我们天黑前会到达那里。 2.否定句:主语+shall /will not+动词+其他成份 She won’t come back this week.这一周她不回来了。 I will not go shopping one hour later. 一小时之后我不会去购物。 He won’t play football with you before he finishes his work.他干完活后才能跟你踢足球。 3.疑问句:shall /will+主语+动词+其他成份 Will you be back in ten minutes? 十分钟后你会回来吗? Will you please open the window? 请你打开窗户好吗? Shall we get something hot to drink? 我们喝一些热饮怎么样? 4.特殊疑问句:特殊疑问词+shall /will+主语+动词+其他成份 Where will you go next week? 下星期你去哪? What shall I do? 我怎么办呢? How many books will they get? 他们将有多少本书?三.will, be going to …, be to…, be about to…的区别 1.be going to +不定式,表示将来。表示打算、准备做的事或即将发生或肯 定要发生的事。be going to和will相比,be going to通常表示主观,will 通常表示客观。 What are you going to do tomorrow? 明天你要做什么? Look at the dark clouds, there is going to be a storm. 看看这些黑云,将有 一场暴风雨。 It’s going to be a fine day tomorrow.明天将会是个好天。 It is going to rain. 要下雨了。 2.“be to+动词原形”表示按计划要发生的事或征求对方意见。这种结构表示 计划中约定的或按职责、义务要求必须去做的事或即将发生的动作。 We are to have a meeting next Saturday. 下个周日我们有个会。 The boy is to go to school tomorrow. 这个男孩明天要去上学。 Are we to go on with this work? 我们继续干吗? The president is to visit China next week.总统下周来访中国。 3.“be about to+动词原形”表示即将发生的动作,意为:很快,马上。后面 一般不跟时间状语。这一结构用于表示客观就要发生的事,表示马上就要 发生。一般不再与时间状语连用。 Don’t go out. We’re about to have a meeting. 别出去了,我们很快就开会 了。 I was about to start when it began to rain.我刚要出发就下起雨来了。 He is about to leave for Shenyang.他将要离开去沈阳。 We are about to leave. 我们马上就走。 The film is about to begin. 电影马上就要开始了。 四.注意事项 1. be about to 不能与tomorrow, next week 等表示明确将来时的时间状语 连用。 2. Let’s …的附加疑问通常使用“…, shall we ?”。 Let’s have a rest, shall we? 3. 问句是“Shall…?”,答句就用“shall ~”;问句用“Will …?”,答 句就用“will ~ ”。要前后保持一致。 Shall you go to school next week ? Yes, I shall. We’ll have an exam . Will you have an exam tomorrow? Yes, I will. / No, I won’t. 一般将来时专项练习 一、单项选择。 ( ) 1. There __________ a meeting tomorrow afternoon. A. will be going to B. will going to be C. is going to be D. will go to be ( ) 2. Charlie ________ here next month. A. isn’t working B. doesn’t working C. isn’t going to working D. won’t work ( ) 3. He ________ very busy this week, he ________ free next week. A. will be; is B. is; is C. will be; will be D. is; will be ( ) 4. There ________ a dolphin show in the zoo tomorrow evening. A. was B. is going to have C. will have D. is going to be ( ) 5. –________ you ________ free tomorrow? –No. I ________ free the day after tomorrow. A. Are; going to; will B. Are; going to be; will C. Are; going to; will be D. Are; going to be; will be ( ) 6. Mother ________ me a nice present on my next birthday. A. will gives B. will give C. gives D. give ( ) 7. –Shall I buy a cup of tea for you? –________. (不,不要。) A. No, you won’t. B. No, you aren’t. C. No, please don’t. D. No, please. ( ) 8. –Where is the morning paper? –I ________ if for you at once. A. get B. am getting C. to get D. will get ( ) 9. ________ a concert next Saturday? A. There will be B. Will there be C. There can be D. There are ( ) 10. If they come, we ________ a meeting. A. have B. will have C. had D. would have ( ) 11. He ________ her a beautiful hat on her next birthday. A. gives B. gave C. will giving D. is going to giving ( ) 12. He ________ to us as soon as he gets there. A. writes B. has written C. will write D. wrote ( ) 13. He ________ in three days. A. coming back B. came back C. will come back D. is going to coming back ( ) 14. If it ________ tomorrow, we’ll go roller-skating. A. isn’t rain B. won’t rain

人教版英语英语现在完成时的用法大全含解析

人教版英语英语现在完成时的用法大全含解析 一、初中英语现在完成时 1.—They say there is a new restaurant near here. —Yes, and it ______ for more than a week. A. has been open B. open C. is opening D. opens 【答案】 A 【解析】【分析】句意:——他们说在这附近有一个新的餐馆。——是的,它已经开了一个多星期了。根据 for more than a week ,可知用现在完成时,have/has been done,故选A。 【点评】考查现在完成时,注意识记其标志词。 2.Mike used to be a top student, but he behind since he lost himself in computer games. A. fell B. has fallen C. was D. has been 【答案】 D 【解析】【分析】句意为“Mike过去是尖子生,但自从迷上电子游戏以来成绩落后了”。由since可知but后的主句用现在完成时,瞬间动词fall不能和since引导的时间状语从句连用,故用延续性动词be。故选D。 【点评】本题考查现在完成时中非延续性动词和延续性动词的转换。 3.—Hi, Tom! you ever the Bird's Nest? —Yes, I have. It's fantastic. A. Have, been to B. Have, gone to C. Did, go to 【答案】 A 【解析】【分析】句意:——你好,Tom!你曾经去过鸟巢吗?——是的,我去过。它是极好的。根据答语—Yes, I have.可知是以have开头的现在完成时的一般疑问句,排除C。have been to+地点名词,去过某地,去了并且回来了;have gone to+地点名词,去了某地,去了还没有回来,在去或者回来的路上。根据It's fantastic.可知去了并且回来了,故选A。 【点评】考查短语辨析,注意平时识记其区别,理解句意。 4.——Where is Mr. Wang? ——He together with his students ________ Zhuyuwan Park. A. has gone to B. have gone to C. has been to D. have been to 【答案】 A

过去完成时知识点总结和题型总结(word)

过去完成时知识点总结和题型总结(word) 一、初中英语过去完成时 1.—We all went to the park except you last weekend. Why didn't you come? —Because I the park twice. A. have gone to B. had gone to C. had been to D. have been to 【答案】 C 【解析】【分析】have gone to去了(尚未回).have been to去过(已回),根据句意在last weekend之前去过,所以用过去完成时,故选C。 【点评】本题考查过去完成时的用法,表示在过去某一时间前已经发生的动作。 2.Sue didn't go to see the film with us last week because she ________________ it with her mother. A. has seen B. had seen C. will see D. saw 【答案】 B 【解析】【分析】句意:苏上星期没和我们一起去看电影,因为她和她妈妈一起看过了。 A.已经看了,现在完成时; B.已经看了,过去完成时; C.将看,一般将来时; D.看了,一般过去时。Sue和妈妈看了电影的影响是上周Sue没有和我们看电影,所以用完成时,根据didn't可知是与过去有关,所以用过去完成时,结构是had+动词过去分词,see的过去分词是seen,故选B。 【点评】考查过去完成时,注意平时识记其结构,理解句意。 3.Jake _____his key in the office so he had to wait until his wife _______ home. A. has forgotten … comes B. forgot… come C. had left… came D. had left…would come 【答案】 C 【解析】【分析】句意:杰克把他的钥匙丢在办公室了,因此他不得不等到他的妻子回家。结合语境可知前文描述的是过去某时前已经完成的动作,故用过去完成时态。下文指的是过去某时的动作,故用一般过去时态。选C。 【点评】英语中的时态主要是借助于时间状语与上下文语境来进行判断。解答此类题型,首先要注意句子中的时间状语,如果没有则要通过分析上下文,结合语境来判断句子的时态。 4.When I ______ the cinema, the film _______for ten minutes A. got to; has begun B. arrived at; has been on C. reached; had begun D. hurried to; had been on

英语一般将来时用法总结(完整)

英语一般将来时用法总结(完整) 一、单项选择一般将来时 1.Peace is necessary to all. After all, it is the United States and China, as the two largest economies in the world, that ________ most from a peaceful and stable Asia-Pacific. A.are benefited B.will benefit C.will be benefited D.had benefited 【答案】B 【解析】 试题分析:根据语境“美国和中国将受益于一个和平稳定的亚太地区”可知该句要用一般将来时,故选B。 考点:考查时态 2.--- I’d like a mountain bike which ____ well? --- Will this one _____? A.rides; work B.rides; do C.is ridden; do D.is ridden; work 【答案】B 【解析】 试题分析:考查主动形式表示被动含义用法。一些不及物动词与副词连用,表示主语的特征。如wash well,write well等;用主动形式表示被动的含义。本句中的ride well指自行车好骑;第二空的do表示行。句意:—我想买一辆很好骑的山地车。—这个行吗?根据句意说明B正确。 考点:考查主动形式表示被动含义的用法。 点评:。一些不及物动词与副词连用,表示主语的特征。如wash well,write well等;用主动形式表示被动的含义。 3.It every day so far this month. I can't tell you if it tomorrow. A.rained; rains B.is raining; shall rain C.has been raining; rains D.has rained; will rain 【答案】D 【解析】 试题分析:本题第一空应该使用现在完成式,关键词是后面的时间状语so far(到目前为止),so far通常都是和现在完成时连用。第二空是一个if引导的宾语从句,并非if引导的条件句,在这个宾语从句中,时间状语是tomorrow,这是一个将来时的时间状语,故该宾语从句使用将来时。句义:这个月到现在为止天天都在下雨,所以我无法告诉你明天是否还要要下雨。故D正确。 考点:考察时态 4.What you learn today ______ of practical use when you hunt for a job. A.is proved B.proves C.will be proved D.will prove

英语过去完成时的用法总结

英语过去完成时的用法总结 它表示句子中描述的动作发生在“过去的过去”。 基本结构 主语+had+过去分词vpp、(done) ①肯定句:主语+had+过去分词、 ②否定句:主语+had+not+过去分词、 ③一般疑问句:Had+主语+过去分词? 肯定回答:Yes,主语+had、 否定回答:No,主语+had not 、 ④特殊疑问句:特殊疑问词或词组+一般疑问句(Had+主语+过去分词)? 基本用法表示在过去某一时刻或动作以前完成了的动作,也可以说过去的时间关于过去的动作。即“过去的过去”。可以用by, before等介词短语或一个时间状语从句来表示,也可以用一个表示过去的动作来表示,还可能通过上下文来表示。 例如: By nine o’clock last night, we had got200 pictures from the spaceship、到昨晚9点钟,我们已经收到200 张飞船发来的图片。 过去完成时-语法判定 1、由时间状语来判定

一般说来,各种时态都有特定的时间状语。与过去完成时连用的时间状语有: (1 ) by + 过去的时间点。如: I had finished reading the novel by nine oclock last night、 (2 ) by the end of + 过去的时间点。如: We had learned over two thousand English words by the end of last term、 (3 ) before + 过去的时间点。如: They had planted six hundred trees before last Wednesday、 2、由“过去的过去”来判定。 过去完成时表示“过去的过去”,是指过去某一动作之前已经发生或完成的动作,即动作有先后关系,动作在前的用过去完成时,在后的用一般过去时。这种用法常出现在: (1 )宾语从句中 当宾语从句的主句为一般过去时,且从句的动作先于主句的动作时,从句要用过去完成时。在told, said, knew, heard, thought等动词后的宾语从句。如: She said that she had seen the film before、 (2 )状语从句中

一般将来时用法小结

一般将来时用法小结 编稿:贾巍审稿:郭宇责编:夏芳莲一般将来时表示在将来某个时间要发生的动作或存在的状态。 一. 一般将来时的构成: 1. 由助动词“ shall/ will +动词原形”构成,shall 用于第一人称,will 用于第二、第三人称,而美式英语在陈述句中无论什么人称,一律用will 。 2. 一般将来时的否定和疑问形式: 一般将来时的否定形式是will not ,缩写为won't; shall not ,缩写为shan't 。 一般将来时的疑问形式是把will/ shall 提到主语前。如:He won’t go to the park this Sunday. 本周日他不去公园。 Will you go swimming with me? 和我一起去游泳好吗? 二. 一般将来时的基本用法: 表示“纯粹的将来”: ①表示将要发生的动作或情况,常带有表示将来的时间状语,如tomorrow, next week, in two days, from now on 等。如:It will be fine tomorrow. 明天天气晴朗。 ②表示预料将要发生的动作或情况。如: You will feel better after having this medicine. 吃了这药,你就会感觉好些的。 ③表示由于习惯倾向而会经常发生的动作,本用法中的will 要重读。如: Boys will be boys. [谚语]男孩毕竟是男孩。 2. 表示“带有情态意义的将来”,用来表示意图,用will 来表示。如:I will be more careful next time. 下次我要更加小心。 I won't go shopping this afternoon, but she will. 今天下午我不想去购物,但她想去。 will 在疑问句中,用来表示有礼貌地征询对方的意见。如:Will you have some more tea? 要不要再喝点茶? What shall we do this weekend? 本周末我们要干什么? 三. 一般将来时的其它几种表示法: 1. 用be going to 表示: be going to 相当于一个助动词,与其后的动词原形一起构成句子的谓语,表示近期将要发生的动作或存在的状态。如:I'm going to see a film this afternoon. 今天下午我想去看电影。 ①“ be going to +动词原形”表示主观上打算在将来某个时间要做某事。如:Her mother is going to buy her a new bike. 她妈妈要给她买辆新自行车。 ②“ be going to +动词原形”还可以表示说话人根据已有的迹象认为将要发生的事。如:It's going to rain. 快要下雨了。 2. 用一般现在时表示将来意义 句中的动词是一般现在时,但所表示的意义却是一般将来时。如:Are you free tomorrow? =

最新英语一般将来时用法总结(完整)(1)

最新英语一般将来时用法总结(完整)(1) 一、单项选择一般将来时 1.If Kate goes to the gym this weekend, _______. A.so do I B.so I do C.so will I D.so I will 【答案】C 【解析】 试题分析:句意:如果凯特这个周末去体育馆,我也去。If引导的条件状语从句用一般现在时态表示一般将来时态,主句用一般将来时态;又因为前句说Kate去体育馆,后句说I也去体育馆,故用全部倒装。故选C。 考点:考查时态和全部倒装句。 2.--- I’d like a mountain bike which ____ well? --- Will this one _____? A.rides; work B.rides; do C.is ridden; do D.is ridden; work 【答案】B 【解析】 试题分析:考查主动形式表示被动含义用法。一些不及物动词与副词连用,表示主语的特征。如wash well,write well等;用主动形式表示被动的含义。本句中的ride well指自行车好骑;第二空的do表示行。句意:—我想买一辆很好骑的山地车。—这个行吗?根据句意说明B正确。 考点:考查主动形式表示被动含义的用法。 点评:。一些不及物动词与副词连用,表示主语的特征。如wash well,write well等;用主动形式表示被动的含义。 3.However hard he tries,the recorder . A.didn’t work B.won’t work C.isn’t working D.hasn’t worked 【答案】B 【解析】 试题分析:考查will用法。句意:无论他多么努力尝试,这个录音机就不工作了。本题中的will表示的是一种倾向性,如The door won’t open.故B正确。 考点:考查will用法 点评:情态动词will有多种不同的用法,will可以表示临时决定做某事;或者表示将来时。 4.--I have you asked John to come to the party this evening? --Yes,I have,but he____ A.doesn't B.hasn't C.hadn't D.won't 【答案】D

英语三种主要完成时的用法总结及练习题培训课件

英语三种主要完成时的用法总结及练习题

一.现在完成时的构成: have(has)+done 二.现在完成时的主要用法: I.“已完成”用法 :表示一个过去发生并结束的动作对现在造成的影响或结果。 这一类情况可以细致分为下述两种情况。 1)表示开始于过去的动作刚刚结束。常和just,now,already,yet,not…yet等不确定的时间状语连用。 2)表示过去动作的结果,现在仍残留着。一般不用时间状语。 I have lost my pen. 我把笔丢了。(说明过去某时丢的,现在我还没找到这支笔) She has become a teacher. 她已经当了老师。(说明她现在仍是老师) II.“未完成”用法。表示动作或状态从过去某时开始,持续到现在,可能继续下去,也可能刚刚结束。常和表示一段时间的状语连用。如today,this week(month),lately,recently,these days,in the past few days,during the last two weeks,since,since yesterday,since 2 days ago,since 1991,for a long time,for a month,so far,up to now,till(until) now等。 He has lived here for 30 years. 他住在这儿三十年了。(现在还住在这儿) III.经验性用法:表示从过去开始到目前为止这段时间中反复发生的动作或多次出现的状态。 常与频度副词如often,always,every week,twice等连用。 I have been to the Summer Palace twice. 我曾经去过颐和园两次。 He has always said so.他总是这么说. 三.现在完成时的时间状语 I现在完成时属于现在时范围,故不能和过去的时间状语连用。如:yesterday,last Sunday,in1990,three years ago等。但是,在强调动作产生的后果和影响时,可以和一些表示不确定的时间状语连用。 a.用副词already和yet。already一般用于肯定句中,yet一般用于否定句和疑问句中。 b.用ever和never.多用于否定或疑问句中,表示“曾经”或“从未“等。 c.用表示到说话为止的过去时间状语,如just, before, up to now, the past few years等。 d. 用包括“现在”在内的时间状语,如now,today,this morning(month,year,term)等。例如:-Have you met him today?-No,I haven't. 今天你见过他吗?我没有。

过去完成时用法小结

过去完成时用法小结 一、过去完成时适用场合 1. 过去完成时表示在过去某一时间或动作以前已经完成了的动作。这个过去的时间常用by,before等介词短语或一个时间状语从句表示,也可以暗含在上下文中。 I had finished my homework before supper.我在晚饭前就把作业做完了。 The play had already started when we got to the theatre. 我们到剧场时戏已经开始了。 By the end of June they had treated over 10,000 patients. 到六月底他们已经治疗了一万多病人。 2. 过去完成时还可表示过去某一时刻之前发生的动作或状态持续到过去某个时间或还要持续下去,常与for,since等词连用。如: He had served in the army for ten years before he retired last year. 他在部队干了十年,去年退役了。 He told me that he had known her since he was a child. 他告诉我他从小就认识她。 He had learned English for eight years before he went to England for further study. 他在去英国深造前,已学了八年英语。 3. 在一段情景连贯的文字中,先发生的事放在后面叙述时,要用过去完成时。如: Tom flew home, but his father had already died. 汤姆乘飞机回家,他的父亲却已经去世了。4. 过去完成时也用于hardly...when...(刚…就…), no sooner...than... (刚…就…), It was the first time + that分句等一些固定句型中。 He had no sooner left the room than they began to talk about him. 他刚离开房间,他们就议论起他来。 We had hardly begun when we were told to stop. 我们刚开始就被叫停。 It was the first time that he had ever spoken to me in such a tune.他用这样的语调跟我讲话,这是第一次。 二、过去完成时与一般过去时的比较 1. 当一个由before, after, as soon as 等连词引导的从句所表示的动作和主句的动作紧接着发生时,两个动作均可用一般过去时来表示。 We had breakfast after we did morning exercises. 做完早操后,我们吃早饭。 The train started to move just before he reached the platform. 他到月台时火车刚开走。 They started ploughing as soon as they got to the fields. 他们一到地里就开始耕地。 2. 按时间顺序叙述两个或两个以上接连发生的动作时,用一般过去时。 He entered the room, turned on the light and sat down at the table. 他走进屋子,打开灯,坐在桌子旁。 3. 在表示某人过去未曾完成的“心愿”、“打算”、“计划”、“想法”、“许诺”等时,hope, mean, plan, think, intend等谓语动词常用过去完成时。 I had hoped to be back last night, but I didn’t catch the train. 我本来希望昨晚回来的,但没搭上火车。 We had thought to return early but they wouldn’t let us go. 我们本想早回来的,但他们不让我们走。 4. 在表示过去的句子中出现常与完成时态连用的词,如:already,yet,since,for,ever,

英语一般将来时用法详解

英语一般将来时用法详解 一、单项选择一般将来时 1.Close the door of fear behind you, and you ______ the door of faith open before you. A.will see B.have seen C.are seeing D.Saw 【答案】A 【解析】 试题分析:句意:关掉你身后的恐惧之门,你就能看到你前面敞开的信念之门。祈使句的句型:动词原形+ and you will表示并列,动词原形+ or you will表示转折。A. will see 一般将来时 B. have seen现在完成时 C. are seeing 现在进行时D. saw一般过去时。根据祈使句的句型特点,故选A。 考点:考查祈使句和动词时态的用法。 2.The computers made by our company sell best, but several years ago no one could have imagined the role in the markets that they ________. A.were playing B.were to play C.had played D.played 【答案】B 【解析】 试题分析:考查时态:我们公司生产的电脑卖的最好,但是几年以后没有人能想象它曾经将在市场中扮演什么样重要的角色。were to do是过去将来时,表示过去想象电脑将会起到的作用。选B。 考点:考查时态 3.It every day so far this month. I can't tell you if it tomorrow. A.rained; rains B.is raining; shall rain C.has been raining; rains D.has rained; will rain 【答案】D 【解析】 试题分析:本题第一空应该使用现在完成式,关键词是后面的时间状语so far(到目前为止),so far通常都是和现在完成时连用。第二空是一个if引导的宾语从句,并非if引导的条件句,在这个宾语从句中,时间状语是tomorrow,这是一个将来时的时间状语,故该宾语从句使用将来时。句义:这个月到现在为止天天都在下雨,所以我无法告诉你明天是否还要要下雨。故D正确。 考点:考察时态 4.--Jack! I have left my key to the office at home. -- Don’t worry. I _________ it for you. Wait a minute. A.get B.am going to get C.will get D.am getting 【答案】C

一般将来时用法小结

一般将来时用法小结: 一般将来时表示在将来某个时间要发生的动作或存在的状态。 一 . 一般将来时的构成: 1. 由助动词“ shall/ will +动词原形”构成, shall 用于第一人称, will 用于第二、第三人称, 2. 一般将来时的否定和疑问形式: 一般将来时的否定形式是 will not ,缩写为 won't; shall not ,缩写为 shan't 。 一般将来时的疑问形式是把 will/ shall 提到主语前。 如: He won’t go to the park this Sunday. 本周日他不去公园。 Will you go swimming with me? 和我一起去游泳好吗? 二 . 一般将来时的基本用法: 1.表示“纯粹的将来”:①表示将要发生的动作或情况,常带有表示将来的时间状语,如 tomorrow, next week, in two days, from now on 等。如: It will be fine tomorrow.明天天气晴朗。②表示预料将要发生的动作或情况。如:You will feel better after having this medicine. 吃了这药,你就会感觉好些的。③表示由于习惯倾向而会经常发生的动作,本用法中的 will 要重读。如: Boys will be boys. [谚语]男孩毕竟是男孩。 2. 表示“带有情态意义的将来”,用来表示意图,用 will 来表示。 如: I will be more careful next time. 下次我要更加小心。 I won't go shopping this afternoon, but she will. 今天下午我不想去购物,但她想去。 will 在疑问句中,用来表示有礼貌地征询对方的意见。如:Will you have some more tea? 要不要再喝点茶?What shall we do this weekend? 本周末我们要干什么? 三 . 一般将来时的其它几种表示法: 1. 用 be going to 表示be going to 相当于一个助动词,与其后的动词原形一起构成句子的谓语,表

相关文档
最新文档