TXT file usage Daquan "recommended"

Source: Internet
Author: User

Source: Full-text link

(3) Read the TXT file to specify the first of a line? To the first? A word

    1. Uservar t=2 "Read txt line text"
    2. Uservar i=5 "Start reading from the first few words"
    3. Uservar o=8 "End read to the first few words"
    4. Text = Plugin.File.ReadFileEx ("path \ filename. txt")
    5. Txtarray=split (Text, "|")
    6. I=i-1
    7. O=o-i:t=t-1
    8. For O
    9. Str=str & Mid (Txtarray (t), 1+i,1)
    10. I=i+1
    11. Endwhile
    12. MessageBox Str
    13. Endscript
Copy Code


(4) Create a new TXT file

    1. Set Fso=createobject ("Scripting.FileSystemObject")
    2. Const FORWRITING=2
    3. Const FORREADING=1
    4. Set Myfile=fso.createtextfile ("path \ filename. txt")
Copy Code


(5) Determine if a file exists

    1. Isfile = Plugin.File.IsFileExit ("path \ filename. txt")
    2. If isfile = True
    3. MessageBox "Found"
    4. Else
    5. MessageBox "Not Found"
    6. EndIf
Copy Code


(6) Write content to TXT file

    1. Set Fso=createobject ("Scripting.FileSystemObject")
    2. Set Myfile=fso.createtextfile ("path \ filename. txt")
    3. MyFile.WriteLine ("content")
    4. Call Plugin.File.WriteFileEx ("path \ filename. txt", "content")
Copy Code


(7) Read TXT file to specify a line of content

    1. Text = Plugin.File.ReadFileEx ("path \ filename. txt")
    2. Txtarray=split (Text, "|")
    3. Display line 5th, write Txtarray (4). Displays line 6th. Just write Txtarray (5)
    4. MessageBox Txtarray (0)
Copy Code


(8) Read all contents of TXT file

    1. I=0
    2. Text = Plugin.File.ReadFileEx ("path \ filename. txt")
    3. Txtarray=split (Text, "|")
    4. While Len (Txtarray (I)) >=1
    5. Re=re & Txtarray (I)
    6. I=i+1
    7. Endwhile
    8. MessageBox RE
Copy Code


(9) How many lines to read TXT file

    1. I=0
    2. Text = Plugin.File.ReadFileEx ("path \ filename. txt")
    3. Txtarray=split (Text, "|")
    4. While Len (Txtarray (I)) >=1
    5. I=i+1
    6. Endwhile
    7. MessageBox I
Copy code TXT file usage Daquan "recommended"

TXT file usage Daquan "recommended"

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.