![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Newbie
Join Date: Dec 2005
Posts: 1
Rep Power: 0
![]() |
chr() split() etc..
Hi.
I'm fairly new to VB. And i was wondering. Could anyone help me with splitting? See i don't know the concept of the functions chr() etc.. For example: If fso.FileExists(App.Path & "\DATA\OBJDATA.TXT") = False Then Exit Function roomdescs = fso.OpenTextFile(App.Path & "\DATA\OBJDATA.TXT", ForReading).ReadAll roomfurniname = Split(roomdescs, finame & "_name = ")(1) roomfurniname = Split(roomfurniname, Chr(13))(0) roomdescription = Split(roomdescs, finame & "_desc = ")(1) roomdescription = Split(roomdescription, Chr(13))(0) thex = Split(SData, " ")(2) they = Split(SData, " ")(3) This laods from a text file etc.. Could anyone explain what is happening in this type of code and explain abit more about packet splitting and chr() Etc? Thanks. |
|
|
|
|
|
#2 |
|
Programmer
|
Chr() returns a character code from the ASCII number given to it. 13 is the symbol for a new line, hence, you're splitting at every new line in that code.
|
|
|
|
|
|
#3 |
|
Expert Programmer
|
However that will leave trailing break Chr(10) characters on each item as on windows the new line sequence is actually CR LF - you should use the constant vbNewLine instead which is a platform dependent constant.
|
|
|
|
|
|
#4 |
|
I eat cake for breakfast.
![]() ![]() ![]() ![]() Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9
![]() |
Because, y'know, VB is used on so many platforms...
![]() |
|
|
|
|
|
#5 |
|
Expert Programmer
|
Mac is (barely) an operating system too. And I really meant .NET which runs on a multitude of architectures and platforms. Anyway it's better programming practice and more legible than a load of magic numbers.
|
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|