<< Click to Display Table of Contents >> Navigation: 3. Script Language > TXT. Text-File Engine > Insert/Delete Text > Insert_Text_at_Pos |
MiniRobotLanguage (MRL)
TXT.itap
TXT.Insert_Text_at_Pos
Insert Text at the specifies Byte-Position in the actual TXT.-Buffer.
Intention
This command is used to Insert Bytes or Text into the internal Text-Buffer at any Position.
After each Line there are 2 Byte with $crlf$ that delimit the Lines.
These will also be counted for the Pos.-Value.
$$OUT=?exeloc\Result.txt
$$TXT=<ABCDEFG>$crlf$<ABCDEFG>$crlf$<ABCDEFG>$crlf$
TXT.Load_Pure_Text|$$TXT
$$HEA=123
$$POS=4
TXT.Insert_Text_at_pos|$$HEA|$$POS
TXT.Save_File|$$OUT
ENR.
Result is:
<AB123CDEFG>
<ABCDEFG>
<ABCDEFG>
Syntax
TXT.itap|P1|P2
TXT.Insert_Text_at_Pos|P1|P2
Parameter Explanation
P1 - (Input,Text) Variable with Text that will be Inserted at Position P2.
P2 - (Input,Numeric) Variable with Byte-Position, where the Text will be inserted. The Text that was before at this position will be moved to the right side.
Example
'*****************************************************
' EXAMPLE 1: TXT.gal
'*****************************************************
' csv-File from:
' https://maloneinstitute-org.translate.goog/wef?_x_tr_sl=en&_x_tr_tl=de&_x_tr_hl=de&_x_tr_pto=wapp
'
$$TMA=#dtime#
IEM.
VAR.$$FIA=$cmdexe$
ELS.
'VAR.$$FIA=?exeloc\Sources\Politician.CSV
'VAR.$$FIA=?exeloc\Sources\WEF-Members.CSV
VAR.$$FIA=?exeloc\Sources\4Zeiler.CSV
'VAR.$$FIA=?exeloc\Sources\Preise_Sample.CSV
EIF.
VAR.$$OUF=?exeloc\Result_#date#.csv
NEF.$$FIA
$$ERR=Die Quelldatei: $$FIA$crlf$existiert nicht.
GTO.ero
EIF.
'-----------------------------------------------------------
TXT.Load_Textfile|$$FIA|$$LIC
' Convert $LF to $crlf$ if needed.
'TXT.lfp
TXT.Get_Line_Count|$$LIC
IVV.$$LIC<5
$$ERR=File is empty?
GTO.ero
EIF.
PRT.$$LIC Lines loaded.
'++++++++++++++++++++++++++++++++
'++++++++++++++++++++++++++++++++
' Place your Script here
$$IND="D"
TXT.sort_by_column_Float|2|$$IND|;|a
$$HEA=Headline$crlf$
TXT.Insert_Text_at_Start|$$HEA
'++++++++++++++++++++++++++++++++
'++++++++++++++++++++++++++++++++
' These lines process and save the result.
'TXT.lfr
TXT.Save_File|$$OUF
EXO.$$OUF
'++++++++++++++++++++++++++++++++
'++++++++++++++++++++++++++++++++
:enx
CAL.$$TMA=#dsince#*1000|i
IVV.$$TMA>1100
CAL.$$TMA=$$$TMA/1000
$$TXT=Programm wird beendet nach $$TMA Sekunden.
ELS.
$$TXT=Programm wird beendet nach $$TMA ms.
EIF.
MBT.$$TXT|Programm Ende|9|32
ENR.
'-----------------------------------------------------------
:ero
PRT.$$ERR
GTO.enx
Remarks
-
Limitations:
-
See also:
• IEF. / NEF. - If - exist - File