| | |
String To Array
Please support our Visual Basic 4 / 5 / 6 advertiser: Programming Forums - DaniWeb Sister Site
Another Small And Simple Function To Take Each Character of a string, and put it into an Array, This helps significantly when you need to sift through a string. This Function Uses The spush (String Push) Function, Also In Code Snippits.
Public Function str2Array(xString As String) As String() Dim tmpArray() As String Dim tmpchar As String ' /* For Each Character In The String */ For I = 1 To Len(xString) ' /* Retrieve The Character */ tmpchar = Mid(xString, I, 1) ' /* Push It Into The Temporary Array */ spush tmpArray, tmpchar Next I ' /* Return The Array To The Calling Procedure */ str2Array = tmpArray End Function
0
•
•
•
•
Couldn't you just do:
The only difference would be that you'd have a char array instead of a string array.
Alternatively, a better way in .net 2.0 would be to use the Array.ConvertAll method.
Regards,
Jan.
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
xString.ToCharArray
The only difference would be that you'd have a char array instead of a string array.
Alternatively, a better way in .net 2.0 would be to use the Array.ConvertAll method.
Regards,
Jan.
Similar Threads
- file to string array (double array) (C)
- converting from string array to int array (C++)
- convert char** (c string array) to std::string[] (C++)
- Value of type 'String' cannot be converted to '1-dimensional array of String'? (VB.NET)
- how to create a dynamic string array to store string items . plz (C++)
| Thread Tools | Search this Thread |
Tag cloud for Visual Basic 4 / 5 / 6
* 6 429 2007 access activex add age append application basic beginner birth bmp c++ calculator cd cells.find click client code college column component connection connectionproblemusingvb6usingoledb copy creat ctrl+f data database datareport date delete dissertations dissertationthesis dissertationtopic edit error excel excelmacro file filename form hardware header iamthwee image inboxinvb internetfiledownload keypress label listbox listview liveperson login looping machine microsoft movingranges objectinsert open oracle password prime program prompt range-objects readfile reading record refresh remotesqlserverdatabase report retrieve save search sendbyte sites sort sql sql2008 sqlserver struct table tags textbox time timer urldownloadtofile vb vb6 vb6.0 vba visual visualbasic visualbasic6 web window windows



