String-Commands * TXT-Command

<< Click to Display Table of Contents >>

Navigation:  3. Script Language > TXT. Text-File Engine > Find- and Replace Operations >

String-Commands * TXT-Command

TXT.Find_Line_with

Previous Top Next


MiniRobotLanguage (MRL)

 

TXT.flw

TXT.Find_Line_with
Search a Text in the TXT.-internal Buffer and return Line-Number and Byte-Position where it was found.

 

 

 

Intention

 

This is the simple search, it will just return the most needed results.

This command is used to get the Line-Number and Byte-Positions of a Search-String,
that was found in the Text that is in the Internal TXT-Buffer, into Variables.

As slightly faster Alternative to TXT.flw, this command will return all needed Information to replace the text or work with it in any way.

 

$$SEA=SWP.

$$LAB=0

TXT.flw|$$SEA|0|$$RES|$$LAB

DMP.6

MBX.$$RES-$$LAB

ENR.

 

If you use the command without Output-Variables, the result will be on the stack in reverse order.

 

TXT.flw|$$SEA

 

What you see here is:

 

TOS:        Byte-Position of found Text in whole Text

TOS+1:        Line-Number where the Text was found

 

 

TXT_FLW_Stack

 

 

Syntax

 

 

TXT.flw|P1[|P2][|P3][|P4]

TXT.Find_Line_with|P1[|P2][|P3][|P4]

 

 

Parameter Explanation

 

P1 - (Input) Variable with String to search for.

P2 - (numeric) Variable will contain a number or 0, this the Starting-Line for the search. The search will at the first byte of the Line.
 If this is 0 or 1, the complete loaded Textfile will be searched.

P3 - (Output) Variable will contain the Line-Number of the Line that contains the Search String.  
 If omitted, the result is placed on TOS.

P4 - (Output) Variable will contain the Byte-Position of the fist-Byte of the Search string in the Text.
 If omitted, the result is placed on TOS.

 

 

Example

 

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

' EXAMPLE 1:

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

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

TXT.ltf|$$LAA|$$RES

VAN.$$LAC=0

$$SEA=SWP.

$$LAB=0

TXT.flw|$$SEA|0|$$RES|$$LAB

JIV.$$RES!13|Lab_failed

JIV.$$LAB!660|Lab_failed

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