|
-
Nov 28th, 2000, 07:21 PM
#1
Thread Starter
Junior Member
Hi,
I coded a little function called TCase to convert a sentence's case to Title Case. I coded it using strings, and it does work fine. But when I started using sentences that exceed 5 KB it became dead slow. A 3 KB sentence will take 1 sec to process, while a 30 KB sentence will take 2 minutes easily. I was upset. So I recoded the whole function once again using arrays. Now a 100 KB sentence takes 0.5 secs hardly, and boy I was pleased.
This is my question:
How does VB handle strings internally in comparison to arrays, and why is the difference in string manipulation speed.
I'd appreciate any tips that could optimize string manipulations in VB.
Thanks.
Rabih Waked
Using Visual Basic 6 Enterprise Edition with SP4.
The clock is ticking, the end of days
A journey awaits...
-
Nov 28th, 2000, 08:07 PM
#2
Have a look at
vbs strconv function, may be save yourself some work.
Just a suggestion.
-
Nov 28th, 2000, 08:09 PM
#3
Oops fogot to mention
If you want to convert
text = "the quick brown fox"
to
text = "The Quick Brown Fox"
then use
text = strconv(text,vbProperCase)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|