<< Click to Display Table of Contents >> Navigation: 3. Script Language > TXT. Text-File Engine > String-Commands * TXT-Command |
MiniRobotLanguage (MRL)
TXT.-Commands
Text-File Operations commands
Intention
These commands are the easy way to work through Textfiles.
What you can do:
1.Load and Save Textfiles,csv-Files
2.Process Textfiles from an internal Cache without need to access the Filesystem
3.Process csv- or delimited Textfiles in multiple ways with a high Speed. Typical real life example are about 1600 - 2000 Lines per second.
4.Store Textfile in Variable (with or without Filename)
5.Restore Textfile from Variable (with or without Filename)
6.Store TXT.-Files in an internal Memory and restore it from there using the TXT.Push_Intern / TXT.Pop_Intern Commands.
7.Remove, insert or Swap colums in a csv-File.
8.Get the Linenumber of a Byte-Position in a Textfile
9.Get the complete Line of specified a Linenumber
10.Get all Lines from specific line to the start or end of text
11.Get the start or end of a Line from a specified Byte-Position
12.Change specfied Lines (replace with a specified line)
13.Get Textfile from the LOF./LFT.-Command or
14.Move a textfile to the LOF./LFT.-Command
15.several Replace Operations and more.
Here is a Quick and incomplete Overview on the Commands:
Load a Textfile int othe internal Buffer for Processing
' $$FIL - Filename
' $$RES (optional) Returns Number of loaded lines
TXT.Load_Textfile|$$FIL[|$$RES]
Clear the internal Buffer
TXT.Clear
' Get Filename of File in Buffer
TXT.gfn|$$FIL
' Get lenght of loaded Text in Bytes
TXT.gtl|$$LAC
' Move Textfile including Filename to Variable
TXT.To_Var|$$VAR
"toc","to_var_and_clear"
' Move Textfile including Filename to Variable and clear internal Buffer
TXT.To_Var|$$VAR
"frv","from_var"
' Get Textfile including Filename from Variable
TXT.From_Var|$$VAR
"lpt","load_pure-Text"
' Load Pure-Textfile and Filename from 2 Variables
TXT.lpt|$$TXT[|$$FIL]
"gpt","get_pure_text"
' "Get Pure Text". Only Textfile into $$TXT. If available, $$FIL returns the Filename
TXT.gpt|$$TXT[|$$FIL]]
"glc","get_line_count"
' "Get Line Count". Get number of loaded lines.
TXT.glc|$$CNT
"gel","get_line"
' Get Line Number $$NUM into $$LIN
' TXT.gel|$$NUM|$$LIN
"gll","get_line_lefttrim"
' Return Line $$LIN, like "gel" but left side trimmed (all ASC 0-32 removed)
TXT.gll|$$LIN|$$RES
"glt","get_line_trimmed"
' Return Line $$LIN, like "gel" but both sides trimmed (all ASC 0-32 removed)
TXT.glt|$$LIN|$$RES
"slt","set_line_to"
' Overwrite Line $$NUM with new Line $$NEW (Replace Line)
TXT.slt|$$NUM|$$NEW
"glp","get_line_position"
' Get position of first and last character of line $$NUM into $$POS and last into $$POE
TXT.glp|$$NUM|$$POS|$$POE
"lnp","linenumber_from_position"
' Get linenumber from Byte-Position $$POS into $$LIN
TXT.lnp|$$POS|$$LIN
"lsp","line_Start_end_by_position"
' Get start/end of Line by Byte-Position in Text
TXT.lsp|$$LIN|$$STR|$$END
"flw","find_line_with"
' Find Line with String. Search first occurence of $$SEA in Textfile, return the Line-Number which has it in $$LIN.
' Falls angegeben suche ab (inkl.) Zeile $$STA
TXT.flw|$$SEA|$$LIN[|$$STA]
"fit","Find_Text"
' $$SEA - Searchstring
' $$FRO - Search from (B)yte or (L)ine
' Returns:
' |$$POT - Postion in Text
' |$$POL - Postion in Line
' |$$LIN - Complete Line
' |$$LNN - Linenumber
TXT.fit|$$SEA|$$FRO[|$$POT][|$$LIN][|$$LNN]
"gbl","get_before_line"
' "Get Before Line". Get all Text that is before and without the specified line into $$BLT.
TXT.gbl|$$LIN|$$BLT
"gal","get_after_line"
' "Get After Line". Get all Text that is After and without the specified line into $$ALT.
TXT.gal|$$LIN|$$ALT
"gts","get_to_start"
' Get all Text from and including the specified line until the start of the text
TXT.gts|$$LIN|$$TXT
"gte","get_to_end"
' Get all Text from and including the specified line until the end of the text
TXT.gte|$$LIN|$$TXT
"sav","save_file"
' Save Text under the Filename with which it was loaded from, or if specified with the specified Filename
' Leaves a result on the TOS, NTFSD-Enabled
TXT.Save[|$$FIL]
"gfl","get_from_lof"
' Get from LOF # will load Textfile from LOF. Index Number $$IND
TXT.get_from_lof|$$IND
"tol","to_lof"
' To lof cache # will put Textfile into LOF. Cache Index Number $$IND
TXT.To_Lof|$$IND
"rit","replace_in_text"
' "replace_in_text". Do a replace over the complete text using a Equalcase-Replace Algo.
' TXT.rit|$$OLD|$$NEW
"ril","replace_in_line"
' "replace_in_line". Do a replace only in the specified Line using a Equalcase-Replace Algo.
TXT.ril|$$LIN|$$OLD|$$NEW[|$$STA]
"rep","Replace"
Search a Text in the TXT.-internal Buffer and replace it with a given other sequence. Will replace all occurrences.
Using TXT.tra there is a 1:1 relation between the characters in $$OLD and the characters in $$NEW.
So if a character in $$OLD is found its replaced with the corresponding Character in $$NEW
Therefore both - $$OLD and $$NEW - MUST have the same lenght, esle there will be no changes and you will get the Timeout Flag set.
TXT.tra|$$OLD|$$NEW[|$$STA][|$$END]
"luf","load_unicode_file"
' Load and convert Unicode-File to ANSI
TXT.luf|$$FIL
"sau","save_as_unicode"
' Convert ANSI-File to Unicode and save (using default codepage)
TXT.sau[|$$FIL]
"ctu","convert_to_unicode"
' Convert ANSI-String to Unicod with default Codepage
TXT.cta|$$ANS|$$UNI
"cta","convert_to_ansi"
' Convert Unicod with default Codepage to ANSI-String
TXT.cta|$$UNI|$$ANS
See also: