ASP Column 属性

定义和用法

Column 属性返回输入流中当前字符位置的列号。

提示:此属性在新行字符被写入之后为 1(在其他字符被写入前)。

语法:
  1. TextStreamObject.AtEndOfStream

实例

  1. <%
  2. dim fs,f,t,x,y
  3. set fs=Server.CreateObject("Scripting.FileSystemObject")
  4. set f=fs.CreateTextFile("c:\test.txt")
  5. f.write("Hello World!")
  6. f.close
  7. set t=fs.OpenTextFile("c:\test.txt",1,false)
  8. do while t.AtEndOfStream<>true
  9. x=t.Read(1)
  10. y=t.Column-1
  11. loop
  12. t.close
  13. Response.Write("文本文件中的最后一个字符是: " & x)
  14. Response.Write("<br /> 字符位置: " & y)
  15. %>

输出:

  1. 文本文件中的最后一个字符是: !
  2. 字符位置: 12

分类导航