'LastDelimter' on string or ' .DelimitedText' on TStringList
Posted: Sun Dec 18, 2011 7:04 pm
I am a total noob to the forum and to Delphi. I have been able to use some of the sample scripts to manipulate some strings (copy, trim, etc). I am trying to develop a script that uses 'LastDelimiter' on the Artist field to return the postion of the last space in an artist name. From there, I hope to get the last name of the artist regardless of the number of spaces in the name (i.e. "Jimi Hendrix" returns "Hendrix", "Stevie Ray Vaughan" returns "Vaughan", "George 'The Animal' Steele" returns "Steele", etc.)
My first attempts result in compile error: 'Unknown dentifier: LastDelimiter'
I'd also looked at using a TStringList.DelimitedText approach, but haven't attempted it.
I'm mostly trying to find out if LastDelimiter or DelimitedText are supported in TGF. Apologies in advance if this is a really stupid newbie question or syntax. I an clueless, and just want to work within what's supported.
My first attempts result in compile error: 'Unknown dentifier: LastDelimiter'
I'd also looked at using a TStringList.DelimitedText approach, but haven't attempted it.
I'm mostly trying to find out if LastDelimiter or DelimitedText are supported in TGF. Apologies in advance if this is a really stupid newbie question or syntax. I an clueless, and just want to work within what's supported.
Code: Select all
program LastName;
var
sTmpArtist : string;
sTmpLast : string;
sTmpFull : string;
iPos : integer;
begin
if not tg_Init then exit;
repeat
sTmpArtist := tg_GetField( 'Artist' );
iPos := LastDelimiter(' ', sTmpArtist);
until not tg_Skip;
end;