StringGetCharacter
Dizginin belirli bir konumundaki sembolün değerine dönüş yapar.
ushort StringGetCharacter(
string string_value,
int pos
);
|
Parametreler
string_value
[in] Dizgi.
pos
[in] Sembolün dizgi içindeki konumu. 0 ile StringLen(metin) -1, aralığında olabilir.
Dönüş değeri
Örnek:
void OnStart()
{
//--- grafik üzerindeki tüm yorumları sil
Comment("");
//--- sembol kodlarının değerlerini elde edeceğimiz bir dizge bildir ve dizge uzunluğunu hatırla
string message = "The script demonstrates the operation of the StringGetCharacter() function";
int length = StringLen(message);
//--- demo dizgesinden elde edilen sembolleri ekleyeceğimiz bir dizge değişkeni bildir
string text = "";
//--- demo dizgesi uzunluğuna göre döngü içerisinde
for(int i=0; i<length; i++)
{
//--- 1/10 saniye bekle
Sleep(100);
//--- demo dizgesindeki döngü indeksinde bulunan dizgeden sembolü al
ushort char_code=StringGetCharacter(message, i);
//--- görüntülenen dizgeye bir sembol ekle ve ortaya çıkan dizgeyi bir grafik yorumu olarak görüntüle
text+=ShortToString(char_code);
Comment(text);
}
//--- iki saniye bekle ve yorumu grafikten kaldır
Sleep(2000);
Comment("");
/*
Sonuç: demo dizgesi ekranda karakter karakter görünür
The script demonstrates the operation of the StringGetCharacter() function
*/
}
|
Ayrıca Bakınız
StringSetCharacter, StringBufferLen, StringLen, StringFill, StringInit, StringToCharArray, StringToShortArray