English
Source / code snippets

Dateipfade Stringmanipulation

 
because of the write one own Installers have I so many File/Paths Stringmanipulationsfunktionen written.

some of it poste I here, but first a couple DEFs of a Herrn Jörg Sellmeyer, which I in Profan-Forum found.
CompileMarkSeparation
Def CharCount(2) Int(Sub(Len(@$(1)),Len(translate$(@$(1),@$(2),""))))
Def VerzeichnisTiefe(1) Int(Sub(Len(@$(1)),Len(Translate$(@$(1),"\",""))))
Def PfadTeil(2) SubStr$(@$(1),@%(2),"\")Vorher sollte man die Verzeichnistiefe ermitteln
Def DateiName(1) SubStr$(@$(1),Add(VerzeichnisTiefe(@$(1)),1),"\")
Def DateiPfad(1) Translate$(@$(1),Add$("\",DateiName(@$(1))),"")
Def Home(0) Translate$(Upper$(Par$(0)),Upper$(FindFirst$(Par$(0))),"")



here some Procs from my in the meantime still älterem Installer:

These function prepares in example a directory c:estest2est3 too then, if it yet garkein directory c:est or c:estest2 gives. The function can sozusagen self-indulgent one To erstellendes directory transfer go, and self the place there becomes prepares.
CompileMarkSeparation
Proc void_CreatePath

    Parameters s$
    declare lw$

    while len (s$)

        Let lw$=add$(lw$,Mid$(s$,1,add(1,len(substr$(s$,1,"")))) )
        let s$=del$(s$,1,add(1,len(substr$(s$,1,""))))

        if (lw$<>"")

            MKDIR lw$

        endif

    wend

Endproc




here another couple undokumentierte:
CompileMarkSeparation
CompileMarkSeparation
CompileMarkSeparation
CompileMarkSeparation
CompileMarkSeparation
CompileMarkSeparation
CompileMarkSeparation

too The function [...]  might not are missing.
 
04/15/04  
 



here another small Zugabe, around the File extension to exchange.

CompileMarkSeparation
 {$i}//file-extension-renamer by iF :-D
print changefileext("somefile.gif","ps")
waitinput
end

proc changefileext

    parameters f$,e$
    declare tmp$,i&,ii&

    if len(f$)

        ifnot instr(".",f$)

            f$:=f$+"."+e$

        else

            repeat

                i&+
                tmp$:=substr$(f$,i&,".")

            until not(len(tmp$))

            sub i&,2
            for ii&:=1 to i& do tmp$:=tmp$+substr$(f$,ii&,".")+"."
            f$:=tmp$+e$

        endif

    endif

    return f$

endproc

 
07/21/04  
 




Sebastian
König
Hello iF,

are You sure, that The procedure void_makesuperpath the power, what You want?

I have time tested:
CompileMarkSeparation
proc void_makesuperpath

    parameters s$
    declare i%
    i%=0

    while lt(i%,len(s$))

        add i%,1

        if equ$(mid$(s$,i%,1),"")

            s$=ins$("",s$,i%)
            add i%,1

        endif

    wend

    return s$

endproc

cls
print void_makesuperpath("c:	est	esthallo")
waitkey

the Result is still certainly not so desired...

You must mind, that The semidetached-Backslashes only in Stringliteralen validly are, not but in variables. concise: One semidetached-Backslash, whom You into code eintippst, is objectively one plainer Backslash.

example:

c:estesthallo is objectively: c:[TAB]est[TAB]esthallo and
c:\Test\Test\Hello is objectively c:estesthallo

or have I The procedure wrong understood?

MfG

Sebastian
 
Windows XP, XProfan/Profan² 4.5 bis 11
Profan2Cpp-Homepage:  [...] 
Alte Profan²-Seite:  [...] 
07/21/04  
 



Yes, have You wrong understood. The procedure isn't for there circa Eingabefehler via Escapesequenzen auszubessern. I have me too in the Description badly framed.

The procedure should objectively just a two make.
circa More went it thereby not, because I others functions having The not after a separate to two sought.

I have but the Proc from the Program taken, circa possible Mißverständnissen from the ways to go.

with Pfadangaben via XPSE there the what You ansprichst via
CompileMarkSeparation
//xpse-source
s$="c:	est
oraanchor":filepre>
or even:
CompileMarkSeparation
 {$iq}//simply demo to demonstrate xpses "Filestring"-directive
case "	est
oe":file<>"	est
oe":print "it works :)"
case "	est
oe":file=="	est
oe":file:print "it works again:)"
print "filename: C:
q	":file
print "escaped : C:
q	"
07/21/04  
 




Sebastian
König
Hello iF,

ok .

[quote:871ef2f47c]with Pfadangaben via XPSE there the what You ansprichst via //xpse-source
s$=c:est
oraanchor:file [/quote:871ef2f47c]
Yes, know I. I find it sincere said but really plainer, whom semidetached-Backslash or Franks Variante (plainer Slash) To using.

comic, that the Topic so often auftaucht...

MfG

Sebastian
 
Windows XP, XProfan/Profan² 4.5 bis 11
Profan2Cpp-Homepage:  [...] 
Alte Profan²-Seite:  [...] 
07/21/04  
 



now, the the Topic so often auftaucht wundert me eigendlich right little.
who in Hochsprachen Proggt is hold geübt too with such Gegebenheiten How Escapesequenzen umzugehen, Profan-Progger are however chiefly Programmier-Beginner, for the Topic often a entrapment darstellt.

I personally be even the opinion, the The Escapesequenzen in Profan nothing to search having. sooner would I understand if one #0, #13#10 etc. possible would. I have to this with XPSE umzusetzen.

[quote:94aea63370=Sebastian king]Hello iF,

I find it sincere said but really plainer, whom semidetached-Backslash or Franks Variante (plainer Slash) To using.[/quote:94aea63370]
now, therefore goes not. It's all right sooner daraum the one simply vergißt. and of course the one soebend a way association has. If one itself means angewöhnt one :file anzusetzen, carry this simply moreover with, the one it Perhaps less except eight läst. because one reminds itself Perhaps on the SYMBOL :file. itself on Slash oda Doppelslash remind is from psychologischer visibility tougher, because it no SYMBOL darstellt. and with Anfängern comes the hold sooner -- How one Yes sees -- to that carry.

Simple Gedankenspiel: Würe it in Profan you don't say so his, Strings simply by anzugeben, separate would there a function for normal Strings namens string(gogol), and Files one file(c would the trouble never emerged, because eachone at the latest to the 1. Fehlschlag itself reminds the it file() To benefit has. One Indizienbeweiß for can his, the itself yet never someone beschwert has the one with string b#,0= no LONGS into area pack can. its hold coherent.

To denne, iF
 
07/21/04  
 




Sebastian
König
Hello iF,

one can sure very long above diskutieren ...

it is correct, as recollection, is your :file really integrally useful.

string() and file() would find I personally plenty To umständlich. rather would I it find, if XProfan How others Languages with not erkannten Escape-Sequenzen (How h in Your c:estesthallo) meckern would. then learn one too right quick, that The Backslashes nunmal a Sonderrolle having.

but what reserves - so has one at least what to that talk...

MfG

Sebastian

P.s.: but not #0, #13#10 would I naturally ooo (Oktal) and xhhh (Hexadezimal) favorisieren .
 
Windows XP, XProfan/Profan² 4.5 bis 11
Profan2Cpp-Homepage:  [...] 
Alte Profan²-Seite:  [...] 
07/21/04  
 



[quote:64eb88146a=Sebastian king]Hello iF,
P.s.: but not #0, #13#10 would I naturally ooo (Oktal) and xhhh (Hexadezimal) favorisieren .[/quote:64eb88146a]
Jaja, is correct already.

I Have but already angemerkt, that I ESC-Seqs in Profan not for correctly. stops. the comes me so a little bit to How :stream in Basic. me goes it means not therefore possible

s$=Hx41LLO write to, separate s$=H+#65+LLO+#13#10

Yup, iF
 
07/21/04  
 




Sebastian
König
Hello iF,

[quote:905bcf7e0d]me goes it means not therefore possible

s$=Hx41LLO write to, separate s$=H+#65+LLO+#13#10 [/quote:905bcf7e0d]
ok, the would a good short cut for @chr$()!

MfG

Sebastian
 
Windows XP, XProfan/Profan² 4.5 bis 11
Profan2Cpp-Homepage:  [...] 
Alte Profan²-Seite:  [...] 
07/21/04  
 



Zum Quelltext


Topictitle, max. 100 characters.
 

Systemprofile:

no Systemprofil laid out. [anlegen]

XProfan:

 Posting  Font  Smilies  ▼ 

Please register circa a Posting To verfassen.
 

Topic-Options

6.103 Views

Untitledvor 0 min.
Sven Bader09/24/21
Björn Haupt05/20/21
Georg04/06/20
Andre Rohland02/19/18
More...

Themeninformationen

this Topic has 2 subscriber:

unbekannt (5x)
Sebastian König (4x)


Admins  |  AGB  |  Applications  |  Authors  |  Chat  |  Privacy Policy  |  Download  |  Entrance  |  Help  |  Merchantportal  |  Imprint  |  Mart  |  Interfaces  |  SDK  |  Services  |  Games  |  Search  |  Support

One proposition all XProfan, The there's!


My XProfan
Private Messages
Own Storage Forum
Topics-Remember-List
Own Posts
Own Topics
Clipboard
Log off
 Deutsch English Français Español Italia
Translations

Privacy Policy


we use Cookies only as Session-Cookies because of the technical necessity and with us there no Cookies of Drittanbietern.

If you here on our Website click or navigate, stimmst You ours registration of Information in our Cookies on XProfan.Net To.

further Information To our Cookies and moreover, How You The control above keep, find You in ours nachfolgenden Datenschutzerklärung.


all rightDatenschutzerklärung
i want none Cookie