ISaGRAF. Version 3.4

         

REPLACE


Àðãóìåíòû:

IN                         MSG              ëþáàÿ ñòðîêà

Str                       MSG              ñòðîêà, êîòîðóþ íóæíî âñòàâèòü

NbC                     INT                 Êîëè÷åñòâî ñèìâîëîâ, êîòîðûå äîëæíû áûòü  óäàëåíû

Pos                     INT                 Ïîçèöèÿ ïåðâîãî èçìåíåííîãî ñèìâîëà

                                                  (ïåðâàÿ ïðàâèëüíàÿ ïîçèöèÿ 1)

Q                          MSG              èçìåíåííàÿ ñòðîêà:

                                                  -NbC ñèìâîëîâ óäàëÿþòñÿ íà÷èíàÿ ñ ïîçèöèè Pos

                                                  -çàòåì ñòðîêà Str ââîäèòñÿ íà÷èíàÿ ñ ýòîé ïîçèöèè

                                                  âîçâðàùàåò ïóñòóþ ñòðîêó åñëè Pos <= 0

                                                  âîçâðàùàåò ñîåäèíåíèå ñòðîê (IN+Str) åñëè Pos áîëüøå, ÷åì äëèíà ñòðîêè IN

                                                  âîçâðàùàåò íà÷àëüíóþ ñòðîêó IN åñëè NbC <= 0

Îïèñàíèå:

Çàìåíÿåò ÷àñòü ñòðîêè íîâûì íàáîðîì ñèìâîëîâ.

(*FBD ïðèìåð áëîêà “REPLACE”*)

(* ST Ýêâèâàëåíò: *)

MyName := REPLACE ('Mr X JONES, 'Frank', 1, 4);

(* MyName - ýòî 'Mr Frank JONES' *)

(* IL Ýêâèâàëåíò: *)

LD                     'Mr X JONES'

REPLACE          'Frank',1,4

ST                     MyName



Ñîäåðæàíèå ðàçäåëà