Register | Login | |||||
Main
| Memberlist
| Active users
| Calendar
| Chat
| Online users Ranks | FAQ | ACS | Stats | Color Chart | Search | Photo album |
| |
0 users currently in Programming. |
Acmlm's Board - I3 Archive - Programming - VB6 Halving strings | New poll | | |
Add to favorites | Next newer thread | Next older thread |
User | Post | ||
Arthus 140 Since: 11-17-05 From: Australia Last post: 6637 days Last view: 6637 days |
| ||
I can't seem to locate a function that can let me half a string. When I tried to make one, I couldn't find anything that would remotly help me in doing so. So does anyone have a function that would let me turn a string into an array.
Example: String = "AE" after putting this string through the function: hlaf("AE") the array would come as follows: results = Array( 1 => "A" 2 => "E" ) Or something along those lines. |
|||
dcahrakos 490 Since: 11-17-05 Last post: 6641 days Last view: 6641 days |
| ||
I know you can use the split function to split strings into an array, but im not sure if you can use split to actually half the string without some delimiter, such as a space, or any other letter or symbol right at the halfway point of the string...so if you did want it like that you could do:
dim arry() as string arry = Split (strng, " "), but that will split the string at every space, you can change the delimiter to whatever, but I dont think split can do halves, ill look for a specific function for you though. |
|||
Dan Purple Leever Since: 11-18-05 Last post: 6433 days Last view: 6424 days |
| ||
The functions you are looking for are the Left function, the Right function, and probably also the Len function.
I'd actually forgotten how poor VB's string support actually is. |
|||
Parasyte + Red Paragoomba Since: 01-05-06 Last post: 6745 days Last view: 6745 days |
| ||
If this is for splitting hexadecimal bytes into nybbles, as it appears to be, you are better off using math:
results(1) = number / 16 results(2) = number Mod 16 |
|||
Kyoufu Kawa Intends to keep Rom Hacking in one piece until the end Since: 11-18-05 From: Catgirl Central Station Last post: 6424 days Last view: 6424 days |
| ||
...but either way, to split using VB6's indeed (and I too think they could be better), use...
firstHalf = Left(fullString, Len(fullString) / 2) secondHalf = Right(fullString, Len(fullString / 2) Might need a +1 or -1 somewhere. |
|||
Sukasa Birdo Not quite as active as before. Xkeeper supporter Xk > ||bass I IP Banned myself! Twice! Since: 11-17-05 From: Somewhere over there Last post: 6425 days Last view: 6424 days |
| ||
Here, I placed kawa's code into a function for you to use.
That should work for you. |
Add to favorites | Next newer thread | Next older thread |
Acmlm's Board - I3 Archive - Programming - VB6 Halving strings | | |