我有一個函數來獲取一個隨機的URL。將函數的結果添加到字符串作爲變量 - SAM廣播器
FUNCTION randurl : String;
BEGIN
// Randomize URL
Rx2 := RandomInt(4);
if (Rx = 0) then
result := 'www.site1.com'
else if (Rx2 = 1) then
result := 'www.site2.com'
else if (Rx2 = 2) then
result := 'www.site3.com'
else if (Rx2 = 3) then
result := 'www.site4.com';
END;
我正在編譯字符串...
var Rx2 : integer;
{Declaration (Functions and Procedures)}
// Construct the GET String for the Web Script, call it and return the output
PROCEDURE update(status : String); forward;
BEGIN
// Message to display in twitter
statusmessage := '#Nowplaying ' + Song['artist'] + ' - ' + Song['title'] + ' @ ' + $FUNCTION_OUTPUT_VARIABLE + ' #' + Song['genre'];
update(statusmessage);
END;
END;
其中$ FUNCTION_OUTPUT_VARIABLE以上,我需要隨機URL被包括在內。如何調用函數,然後在代碼的每次傳遞中插入輸出?
非常感謝!
編輯:
下面是我用上述的功能去解決。
{Declaration (Variables)}
var Rx2 : integer;
FUNCTION randurl : String; forward;
BEGIN
// Message to display in twitter
statusmessage := '#Nowplaying ' + Song['artist'] + ' - ' + Song['title'] + ' @ ' + randurl + ' #' + Song['genre'];
update(statusmessage);
END;
END;
這不是德爾福。它是什麼? –
它是PAL,來自基於Pascal/Delphi的SAM廣播公司的語言。它具有定製的對象,但有很多相似之處。我不是一個編碼器,但據我所知,在字符串中作爲變量來獲取函數遵循相同的語法/方法。你在這裏看到的是連接。我只想在每次傳遞中將所述函數的結果作爲變量放入。希望這是有道理的。 –
你的意思是你不能用randurl替換$ FUNCTION_OUTPUT_VARIABLE? –