StringGetCharacter

Dizginin belirli bir konumundaki sembolün değerine dönüş yapar.

ushort  StringGetCharacter(
   string  string_value,     // dizgi
   int     pos               // sembolün dizgi içindeki konumu
   );

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

Sembol kodu veya hata durumunda 0. Hata kodunu alabilmek için GetLastError() fonksiyonunu çağırın.

Ö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=0i<lengthi++)
     {
      //--- 1/10 saniye bekle
      Sleep(100);
      //--- demo dizgesindeki döngü indeksinde bulunan dizgeden sembolü al
      ushort char_code=StringGetCharacter(messagei);
      //--- 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