[Vala] Sorting Array



Hallo, I have to little questions:

1) Is there a function to sort arrays without using Posix.qsort?
Example:

  int[] arr = { 10, 5, 45, 12 };
  Posix.qsort(arr, arr.length, sizeof(int), (pa, pb) => { return
(*(int*)pa) - (*(int*)pb); } );

2) Is there a function to compare two string partially without using
Posix.strncmp ?
Example:

  string a = "hallo my friends!";
  string b = "hallo people!";

  if( Posix.strncmp( a, b, 5) ==0 ) -> wil be true

thanks


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]