Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Char Array to String conversion - How-To? 1

Status
Not open for further replies.

IlyaRabyy

Programmer
Nov 9, 2010
571
US
Colleagues,

long-story-short:
Got a Char array lcBuffer(14);
How to convert it from array into a String?
(Tried to find it in MS documentation - and failed; alternative (For I = 0 To 13 lcStr = lcStr & lcBuffer(I) End For) is doable but not appealing...)

Please advise!

TIA!

Regards,

Ilya
 
Got it, works!

Thank you, Mint Julep! (Do I know you from my Atlantax days?)

Regards,

Ilya
 
T'was company (ceased to exist long ago) I used to work for, and t'was my coworker's... U/N? or P/W?... CRS! But not on company's network.

My apologies, no offense was meant.

Regards,

Ilya
 
Ilya,
Don't forget the Star to mintjulep for his help...


---- Andy

There is a great need for a sarcasm font.
 
To Andrzejek:
Done.
Don't worry, I am very well familiar with this concept and its implementation, colleague! ;-)

Regards,

Ilya
 
Not sure I think that we have the right solution, actually. Seems to me you were asking how to convert an array of individual characters into a string, not how to convert an array of strings into a single string.

if it is the former, then the old VB6 trick of simply assigning a byte array to a string works. Indeed it works better, since there's no need to consider if we are translating between unicode and ascii/ansi, whilst string.join would seem to me to be a bit of overkill for this. - and is about twice as slow as the straight assignment.

So this kind of thing works fine and as expected:
Code:
[blue]    Dim fred(14) As Char
    Dim mystring As String
    fred = "Test ®ƣɧʕ"
    mystring = fred
    msgbox(mystring)[/blue]



 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top