English
Forum

String single Letters apart

 
- Page 1 -



Jörg
Sellmeyer
Gibts a faster/kürzere Version as that here?
CompileMarkSeparation
Set("Decimals",0)

Proc Zerlege1

    Parameters Text$,Trenner$
    Declare Ergebnis$

    WhileLoop Len(Text$)

        Ergebnis$ = Ergebnis$ + Mid$(Text$,&Loop,1) + Trenner$

    Wend

    Return Ergebnis$

EndProc

Proc Zerlege2

    Parameters Text$,Trenner$
    Declare Ergebnis$

    WhileLoop Len(Text$)

        Ergebnis$ = Ergebnis$ + SubStr$(Text$,&Loop) + Trenner$

    Wend

    Return Ergebnis$

EndProc

Proc Zerlege3

    Parameters Text$,Trenner$
    Declare Ergebnis$,c&
    c&=len(text$)-1

    WhileLoop c&,1,-1

        Text$ = Ins$(Trenner$,Text$,&loop)

    Wend

    Return Text$

EndProc

Proc Zerlege4

    Parameters t$,u$
    declare e$,f&
    f&=Addr(t$)

    whileloop 0,Len(t$)-1

        e$=e$+Char$(f&,&Loop,1)+u$

    endwhile

    Return e$

endproc

Def MultiByteToWideChar(6) !"Kernel32","MultiByteToWideChar"

Proc Zerlege5

    Parameters Text$,Trenner$
    Declare c&,b#
    c& = Len(Text$) * 2 + 1
    Dim b#,c&
    MultiByteToWideChar(0,0,Addr(Text$),Len(Text$),b#,c& )
    Text$ = Translate$(Char$(b#,0,c& - 1),"z","|")
    Return Text$

EndProc

Cls
Var a& = &GetTickCount
ClearClip
PutClip "Z01 Z02 Z03 Z04 Z05
"

WhileLoop 5

    Zerlege1(MkStr$("ABCDEFGHIJKLMNOP",200),"|")
    PutClip  Str$(&GetTickCount - a&) + " "
    a& = &GetTickCount
    Zerlege2(MkStr$("0123456789012345",200),"|")
    PutClip  Str$(&GetTickCount - a&,) + " "
    a& = &GetTickCount
    Zerlege3(MkStr$("QRSTUVWXYZÄÖÜß@A",200),"|")
    PutClip  Str$(&GetTickCount - a&) + " "
    a& = &GetTickCount
    Zerlege4(MkStr$("0987654321098765",200),"|")
    PutClip  Str$(&GetTickCount - a&) + " "
    a& = &GetTickCount
    Zerlege5(MkStr$("qjeudkfotlgkcjdh",200),"|")
    PutClip  Str$(&GetTickCount - a&) + "
    "
    WindowTitle Str$(&Loop)

Wend

Print GetClip$(on class=s2>)
WaitInput
 
Windows XP SP2 XProfan X4
... und hier mal was ganz anderes als Profan ...
08/08/08  
 



 
- Page 1 -



RGH
@iF:
To SizeOf() from the Help:

@SizeOf(V)
V : name of/ one variables
Result: Longint

mind The Description the Parameters! one ought to The function already so benefit, How tappt im dunkeln virtual is and not How one tappt im dunkeln Perhaps gladly had! for something other as a Variablenbezeichner as Parameter is the function crept not definiert.

Greeting
Roland
 
Intel Duo E8400 3,0 GHz / 4 GB RAM / 1000 GB HDD - ATI Radeon HD 4770 512 MB - Windows 7 Home Premium 32Bit - XProfan X4
08/08/08  
 




Jac
de
Lad

CompileMarkSeparation
Proc Zerlege3

    Parameters t$,u$
    declare e$,f&
    f&=Addr(t$)

    whileloop 0,Len(t$)-1

        e$=e$+Char$(f&,&Loop,1)+u$

    endwhile

    Return e$

Profan² 2.6 bis XProfan 11.1+XPSE+XPIA+XPRR (und irgendwann XIDE)
Core2Duo E8500/T2250, 8192/1024 MB, Radeon HD4850/Radeon XPress 1250, Vista64/XP
08/08/08  
 



Zerlege3 there already, How plenty Time needed your "Zerlege4" in the Ggs. to that Zerlege3 Jac?
 
08/08/08  
 



Nachtrag: @Jörg: have another idea which Perhaps faster is as any others recent here geposteten Algos.

whom String simply in a WideString konvertieren and by Translate The nobodies supplant...

accordingly would the Meiste on native Abarbeitung encamped, means very fix... - and one needed no Loop More.
 
08/08/08  
 




Jörg
Sellmeyer
Jacs Version is something faster as my both, but slower as The of David:
Z01 Z02 Z03 Z04

375 266 171 344

782 500 359 484

984 516 375 469

969 500 375 469

969 515 360 437

703 250 218 360

829 515 360 375

625 250 187 234

609 438 375 469

969 515 375 469


now I will yet The WideString-Variante testing.
can someone explain, Why the first Passage explicit faster is? this is too so, if I instead of PutClip, the each sowort on the screen bring. I had sooner expects, that it faster becomes.

Nachtrag:
super! MultiByteToWideChar is it:
Z01 Z02 Z03 Z04 Z05

375 250 203 266 15

265 250 297 469 0

516 500 375 468 0

516 500 375 469 15

515 500 391 469 0


supra in the first Posting have I any versions zusammengefaßt.
 
Windows XP SP2 XProfan X4
... und hier mal was ganz anderes als Profan ...
08/08/08  
 




Jac
de
Lad
@iF: has itself already Done.
 
Profan² 2.6 bis XProfan 11.1+XPSE+XPIA+XPRR (und irgendwann XIDE)
Core2Duo E8500/T2250, 8192/1024 MB, Radeon HD4850/Radeon XPress 1250, Vista64/XP
08/08/08  
 



 
- Page 2 -



can someone explain, Why the first Passage explicit faster is?


IMHO because of Delphi, it uses a very dynamic AnsiStringVerwaltung...
 
08/08/08  
 




Frank
Abbing
The conversion in a Unicodestring might not any more To toppen his!
 
08/08/08  
 




Jörg
Sellmeyer
Yes, somehow comes one not any more under zero. Perhaps creates it Yes of/ one, a Algorhythmus To write, with the one Time win...
 
Windows XP SP2 XProfan X4
... und hier mal was ganz anderes als Profan ...
08/08/08  
 



this is the Community-Algorithmus...
 
08/08/08  
 



Frank Abbing
The conversion in a Unicodestring might not any more To toppen his!


has but too a disadvantage, because "XProfanstrings" are binärsicher, Zerlege1-4 too, Zerlege5 not - ultimately becomes here with z aufgefüllt and goes because of the Translate from the Orginalstring lost. nothing is for everything well.
 
08/08/08  
 




Jörg
Sellmeyer
for my object is it inspired, I only numbers into Strings have.
 
Windows XP SP2 XProfan X4
... und hier mal was ganz anderes als Profan ...
08/08/08  
 




Answer


Topictitle, max. 100 characters.
 

Systemprofile:

no Systemprofil laid out. [anlegen]

XProfan:

 Posting  Font  Smilies  ▼ 

Please register circa a Posting To verfassen.
 

Topic-Options

5.287 Views

Untitledvor 0 min.
RudiB.04/26/22
Manfred Barei11/18/18
Heiko Dix11/13/12
Frank Vorholzer05/24/12

Themeninformationen



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