String-Commands * TXT-Command

<< Click to Display Table of Contents >>

Navigation:  3. Script Language > TXT. Text-File Engine > Get Lines and Text >

String-Commands * TXT-Command

TXT.Line_Start_End_by_Position

Previous Top Next


MiniRobotLanguage (MRL)

 

TXT.lsp

TXT.Line_Start_End_by_Position
Get Byte-Positions of Line Start and End using an Byte-Position as Input, from TXT.-internal Buffer into Variables.

 

 

 

Intention

 

This command is used to get the Byte-Positions of Start- and End of a specified Line,

from the Text that is in the Internal TXT-Buffer into Variables.

Unlike TXT.glp, it works from a Byte-Position. So you say "Byte 42" and the command will return the start- and End-Byte of the line,

that contains Byte 43. Variable P2 will contain the Start-Byte of the Line. Variable P3 will contain the Last-Byte of the Line before

and excluding the $crlf$.

This Command can be used to work on a Byte-Base through a file without accessing the file on the harddrive.

 

' Byte 35 is in Line 2

TXT.lnp|35|$$LAC

JIV.$$LAC!2|Lab_failed

' Get Line 2 Start and End-Position

TXT.glp|$$LAC|$$LAD|$$LAE

JIV.$$LAB!9|Lab_failed

JIV.$$LAC!56|Lab_failed

' Get Byte 35 Start and End-Position (of that Line containing Byte 35)

TXT.lsp|35|$$LAB|$$LAC

JIV.$$LAB!9|Lab_failed

JIV.$$LAC!56|Lab_failed

ENR.

 

 

Syntax

 

 

TXT.lsp|P1|P2|P3

TXT.Line_Start_End_by_Position|P1|P2|P3

 

 

Parameter Explanation

 

P1 - (Input,numeric) Variable with Byte Position.

P2 - (Output) Variable will contain the Start-Byte of the Line that contains this Byte. If omitted, the result is placed on TOS.

P3 - (Output) Variable will contain the End-Byte of the Line. If omitted, the result is placed on TOS.

 

 

Example

 

'*****************************************************

' EXAMPLE 1: TXT.glp

'*****************************************************

' Get Line Number $$NUM into $$LIN

VAR.$$LAA=?path\..\Pics\Test.txt

TXT.lnp|100|$$LIN

TXT.lsp|100|$$STA|$$END

MBX.Byte 100 is in line $$LIN from: $$STA to $$END

ENR.

 

 

Remarks

 

-

 

Limitations:

 

-

 

 

See also:

 

  TXT.Load Textfile

  TXT.Clear

  TXT.From_Var

  TXT.Load_pure_Text

  TXT.Get_pure_Text

  FIL.Generate numbered Name

  FIL.Move numbered File

  ATF - Append-to-File

  CFF. - Copy-From-File

  CTF - Copy-To-File

  COP. - Copy File

  TXT.Get_Filename

  TXT.Get_Lenght

  TXT.To_Var_and_Clear

    GLC. - Get-Line-Count

    TXT.Get_Line

    IEF. / NEF. - If - exist - File

    LFF - Line-From-File

    WFF. - Wait-For-File

    REN. - Rename File/Dir