Convert to Char[] or just use String[i]

  • Thread starter Thread starter pigeonrandle
  • Start date Start date
P

pigeonrandle

Quickie time!
Is indexing using String to get individual characters 'as quick' as
converting the String to a Char[] and then using Char? Is the
conversion to Char[] worth the processing?

In advance, i thank you,
James Randle.
 
Hi James,

string is like a readonly char[]. Access of individual characters from a
string should be the same as accessing them from an char[]. So the
conversion to char[] would be only extra processing and memory management,
withour any use.

Christof
 
Christof,

Cheers.


Christof said:
Hi James,

string is like a readonly char[]. Access of individual characters from a
string should be the same as accessing them from an char[]. So the
conversion to char[] would be only extra processing and memory management,
withour any use.

Christof

pigeonrandle said:
Quickie time!
Is indexing using String to get individual characters 'as quick' as
converting the String to a Char[] and then using Char? Is the
conversion to Char[] worth the processing?

In advance, i thank you,
James Randle.
 
Converting to a Char[] and then retrieving the indexed value will retrieve a
system.Char structure. Indexing into a string returns a system.String
object. Normally, the latter is quicker since there is no copy to an array,
but sometimes you want the char result.

Mike Ober.
 
Back
Top