
Ich habe ein Problem...
Und zwar soll...
Der String:
Code: Alles auswählen
Hallo ich bin ein String.
Code: Alles auswählen
H a l l o i c h b i n e i n S t r i n g .
Code: Alles auswählen
H l o i h...
Kann mir denn jemand helfen ?
Fusselohr
Code: Alles auswählen
Hallo ich bin ein String.
Code: Alles auswählen
H a l l o i c h b i n e i n S t r i n g .
Code: Alles auswählen
H l o i h...
Code: Alles auswählen
Procedure.s Spacifize(string.s)
Protected newstr.s
Protected *ptr.Character = @string
While *ptr\c
If Len(newstr) > 0
newstr + " "
EndIf
newstr + Chr(*ptr\c)
*ptr + SizeOf(Character)
Wend
ProcedureReturn newstr
EndProcedure
Debug Spacifize("Hallo ich bin ein String.")
Code: Alles auswählen
Procedure.s DoppelString(String.s, Separator.s = " ")
Protected helpstring.s, len, i
len = Len(String)
For i = 1 To len
helpstring + Mid(String, i, 1) + Separator
Next
ProcedureReturn helpstring
EndProcedure
Debug DoppelString("Hallo ich bin ein String")
Code: Alles auswählen
Procedure.s Spacifize(string.s)
Protected newstr.s,first.l
Protected *ptr.Character = @string
While *ptr\c
If first
newstr + " "
Else
first=1
EndIf
newstr + Chr(*ptr\c)
*ptr + SizeOf(Character)
Wend
ProcedureReturn newstr
EndProcedure
Code: Alles auswählen
Procedure.s Spacifize(string.s)
Protected newstr.s,first.l
Protected *ptr.Character = @string
While *ptr\c
If first
newstr + " "
Else
first=1
EndIf
newstr + Chr(*ptr\c)
*ptr + SizeOf(Character)
Wend
ProcedureReturn newstr
EndProcedure
Procedure.s DoppelString(String.s, Separator.s = " ")
Protected helpstring.s, len, i
len = Len(String)
For i = 1 To len
helpstring + Mid(String, i, 1) + Separator
Next
ProcedureReturn helpstring
EndProcedure
x = ElapsedMilliseconds()
For i = 1 To 100000
Spacifize("Hallo ich bin ein String")
Next
res1 = ElapsedMilliseconds() - x
x = ElapsedMilliseconds()
For i = 1 To 100000
DoppelString("Hallo ich bin ein String")
Next
res2 = ElapsedMilliseconds() - x
MessageRequester("Result 1", Str(res1))
MessageRequester("Result 2", Str(res2))
Code: Alles auswählen
Procedure.s Spacifize(string.s)
Protected newstr.s
Protected *ptr.Character = @string
While *ptr\c
newstr + " " + Chr(*ptr\c)
*ptr + SizeOf(Character)
Wend
ProcedureReturn Trim(newstr)
EndProcedure
Code: Alles auswählen
Macro Happy
;-)
EndMacro
Happy End
Code: Alles auswählen
Macro Happy
;-)
EndMacro
Happy End