Ta brskalnik ni več podprt.
Izvedite nadgradnjo na Microsoft Edge, če želite izkoristiti vse prednosti najnovejših funkcij, varnostnih posodobitev in tehnične podpore.
To sort a string array, why is it important to use the String.Trim() method on each array element before sorting?
String.Trim()
Only string arrays with elements trimmed with String.Trim() can sort.
String.Trim() removes leading white space that would sort before numbers and letters.
The array sort is noticeably faster using String.Trim() on each element.
Both foreach and for are good choices to iterate small single dimension arrays like {"cat", "fox", "dog", "snake", "eagle"}, but when is it best to use a for loop?
foreach
for
When the elements have alphabetical sort order.
To perform a search on each element in the array.
To evaluate a specific range of elements.
You must answer all questions before checking your work.
Ali je bila ta stran uporabna?
Ali potrebujete pomoč za to temo?
Ali želite preskusiti storitev Ask Learn, ki pojasni ali vas vodi skozi to temo?