Autor Beitrag
Robii
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 236



BeitragVerfasst: Mo 15.06.09 15:54 
Hey ich habe einen String der heißt 'Robin_123.txt'
jetzt möchte ich aber nur 'Robin' in einem neuen String speichern,
wie mache ich das?
Gruß
Regan
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 2157
Erhaltene Danke: 72


Java (Eclipse), Python (Sublimetext 3)
BeitragVerfasst: Mo 15.06.09 15:57 
Schau dir mal Pos, Length und Copy an.
Popov
ontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic starofftopic star
Beiträge: 1655
Erhaltene Danke: 13

WinXP Prof.
Bei Kleinigkeiten D3Pro, bei größeren Sachen D6Pro oder D7
BeitragVerfasst: Mo 15.06.09 16:05 
user profile iconRobii hat folgendes geschrieben Zum zitierten Posting springen:
Hey ich habe einen String der heißt 'Robin_123.txt'
jetzt möchte ich aber nur 'Robin' in einem neuen String speichern,
wie mache ich das?
Gruß


Wo ist das Problem?

Du hast ein String mit 'Robin_123.txt':

s1 := 'Robin_123.txt';

Jetzt möchtest du 'Robin' in einem neuen String:

s2 := 'Robin';

Fertig.

_________________
Popov
alzaimar
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2889
Erhaltene Danke: 13

W2000, XP
D6E, BDS2006A, DevExpress
BeitragVerfasst: Mo 15.06.09 16:23 
:rofl:
Popov, deine Problemlösung ist 100%ig korrekt, zumindest wenn man die Problemstellung wortwörtlich umsetzt. Ich vermute jedoch, das der Fragesteller eine etwas allgemeinere Lösung wollte. Natürlich ergibt sich das nicht aus der Wortwahl und Problembeschreibung, aber es könnte sein.

Kann es sein, das Du den Fragesteller mit deiner Antwort dezent auf den kreativeren Umgang mit der deutschen Sprache und hier im Besonderen mit der Präzisierung einer Frage hinweisen wolltest?

_________________
Na denn, dann. Bis dann, denn.
Lannes
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2352
Erhaltene Danke: 4

Win XP, 95, 3.11, IE6
D3 Prof, D4 Standard, D2005 PE, TurboDelphi, Lazarus, D2010
BeitragVerfasst: Mo 15.06.09 17:10 
Hallo,

hab schon wesentlich unpräzisere Fragen gesehen,
nimmt man den Titel(Teil - String) dazu, ist die Frage eigentlich eindeutig :wink:

@user profile iconRobii
Du brauchst nur Pos und Copy.
Pseudocode:
Kopiere den Teilstring ab Index 1
bis ein Zeichen vor Positon von '_'

_________________
MfG Lannes
(Nichts ist nicht Nichts) and ('' <> nil ) and (Pointer('') = nil ) and (@('') <> nil )
Webo
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 577
Erhaltene Danke: 14

Win 7, Debian
C# (Visual Studio 2013), PHP, C, C++ (Eclipse, KDevelop)
BeitragVerfasst: Mo 15.06.09 17:17 
Ich denke, er wollte das ;-)

Zum Thema: Pos und Copy sind schon der richtige Weg zur Lösung ...

_________________
Man kann nur das aus dem Ärmel schütteln, was man auch vorher reingesteckt hat.
Robii Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 236



BeitragVerfasst: Mo 15.06.09 22:03 
Danke, klappt jetzt. Hab mich da ein bisschen eingelesen.
Gruß