Autor Beitrag
kuhlthomas
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 35



BeitragVerfasst: Mo 02.02.04 00:40 
hallo

ich will einen string um das erste zeichen kürzen, das erste zeichen soll also wegfallen. bsp:
1110 soll zu
110
werden

danke
Raphael O.
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1596


VS 2013
BeitragVerfasst: Mo 02.02.04 00:47 
ausblenden Delphi-Quelltext
1:
edit1.Text:=copy(edit1.Text,2,length(edit1.Text)-1);					

wobei man edit1.text durch jede stringvariable ersetzen kann ;)
kuhlthomas Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 35



BeitragVerfasst: Mo 02.02.04 00:59 
danke für deine antwort

ich hab das grad mal probiert und auch ohne dei -1 komm ich zum gewünschten ergebnis (mit allerdings auch) darum wollte ich wissen warum du sie gesetzt hast
grayfox
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 800

win98, winXP
D4 Standard; D6 Personal
BeitragVerfasst: Mo 02.02.04 01:08 
hallo tom!

na überleg mal, was mit der länge deines strings passiert, wenn du ihn um eine stelle verkürzt...
kuhlthomas Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 35



BeitragVerfasst: Mo 02.02.04 01:13 
schon klar ich hab mir das nur so vorgestellt, dass die 2 für die stelle steht ab der der string übernommen wird muss man also auchnoch die länge des neuen strings mit angeben?
Raphael O.
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1596


VS 2013
BeitragVerfasst: Mo 02.02.04 01:19 
die Parameter von copy:
1.: string, aus dem kopiert werden soll
2.: ab der wievielten stelle
3.: wieviele Zeichen

wenn man jetzt das "-1" nicht hat, dann kopiert man quasi ein ZEichen mehr, als der String hat,a us dem man kopiert... das bemerkt delphi dann und deshalb macht es keinen unterschied ob man es angibt oder nicht... allerdings schadet es nicht und ist eigentlich korrekter, da man ja nur bis einschließlich des letzten Zeichens kopieren will und danach nichts mehr ;)
BungeeBug
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 901



BeitragVerfasst: Mo 02.02.04 07:37 
HI,

ich hab auch noch einen ...

ausblenden Delphi-Quelltext
1:
SetLength(String,NewLengths);					
Raphael O.
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1596


VS 2013
BeitragVerfasst: Mo 02.02.04 10:00 
da solltest du jetzt aber nochmal erklären, wie man damit den ersten Buchstaben löschen kann :roll: