is there a function to convert a string to an array of characters?
I wrote my own, but just wondering if there is a way to do so
Printable View
is there a function to convert a string to an array of characters?
I wrote my own, but just wondering if there is a way to do so
Any chance of including your own version in the next update of the VBCodeBook CodePack?
sure :)Quote:
Originally posted by RealNickyDude
Any chance of including your own version in the next update of the VBCodeBook CodePack?
VB Code:
Public Shared Function StringToChar(ByVal s As String) As Char() If s Is Nothing Then Return Nothing Dim chars(s.Length - 1) As Char Dim i As Integer For i = 0 To s.Length - 1 chars(i) = CChar(s.Substring(i, 1)) Next Return chars End Function
would you put my name there?:D
Is this what your talking about?
VB Code:
Dim TheWord As String = "Moo" Dim Letters() As Char Letters = TheWord.ToCharArray()
yeah, thanks again, you're the man:DQuote:
Originally posted by FireRabbit
Is this what your talking about?
VB Code:
Dim TheWord As String = "Moo" Dim Letters() As Char Letters = TheWord.ToCharArray()
Convert.ToChar()
I believe that doesnt return an array. But thanks for posting... I didnt know a Convert class existed :D I guess it's the same as CType, CByte, CWhatever functions thoughQuote:
Originally posted by PT Exorcist
Convert.ToChar()
actually it isnt the same as ctype...there are conversions ctype can't do and Convert.Toxxxx can do