#1 2019-09-19 14:49

Stefan
Moderator
From: Germany, EU
Registered: 2007-10-23
Posts: 1,161

PascalScript: If InStr(FileName, 'search text') Then

Hi Denis,

do we have already an InStr() PascalScript function?


WideInStr(input, search): Boolean ;


If( WideInStr(FileName, 'example')  ) Then
     FileName := 'text' + FileName;



Or else, would you please put that on your To-Do List big_smile




Always trying to find some work for you tongue
 


Read the  *WIKI* for HELP + MANUAL + Tips&Tricks.
If ReNamer had helped you, please *DONATE* to Denis or buy a PRO license. (Read *Lite vs Pro*)

Offline

#2 2019-09-21 12:24

den4b
Administrator
From: den4b.com
Registered: 2006-04-06
Posts: 3,440

Re: PascalScript: If InStr(FileName, 'search text') Then

Hi Stefan,

I think the use cases of InStr / WideInStr are already covered by Pos, PosEx, WidePos, WidePosEx, WideTextPos, WideTextPosEx.

I am reluctant to adding a too many similar functions to Pascal Script.

Offline

#3 2019-09-25 07:56

Stefan
Moderator
From: Germany, EU
Registered: 2007-10-23
Posts: 1,161

Re: PascalScript: If InStr(FileName, 'search text') Then

Thanks for the feedback. you are right, I missed that and try to remember.


Examples:


VBScript InStr
        ShowMessage(   IntToStr( WidePos('R',FileName) )  );
        if( WidePos('R',FileName) >0 )then ShowMessage(FileName);
                //Or:
        if( Pos('Otto',FileName) >0 )then
        begin
            ShowMessage(FileName)
            FileName := '__' + FileName
        end;   




VBScript InStrRev()
        strReversed := WideReverseString(FileName);                     //Return reversed string.
        intPosRev   := WidePos('Otto', strReversed);
        ShowMessage(  IntToStr(intPosRev) );
        //Or:
        intPosRev   := WidePos('Otto', WideReverseString(FileName));
        ShowMessage(   IntToStr(  WidePos('o', WideReverseString(FileName)) ) );



THX big_smile


Read the  *WIKI* for HELP + MANUAL + Tips&Tricks.
If ReNamer had helped you, please *DONATE* to Denis or buy a PRO license. (Read *Lite vs Pro*)

Offline

Board footer

Powered by FluxBB