Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 strings in vb
Index -> Programming, Visual Basic and Other Basics -> Visual Basic Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Homer_simpson




PostPosted: Sun Nov 09, 2003 2:34 pm   Post subject: strings in vb

say i got this string:
s="jackass"

how can i make it print the third character "c"
i tried print s(3) but it doesn't work like that =(
Sponsor
Sponsor
Sponsor
sponsor
Tony




PostPosted: Sun Nov 09, 2003 3:16 pm   Post subject: (No subject)

well, to use substrings in VB, you can use Mid(from:int, length:int)

so 3rd character would be
Mid(3,1)

Now the string itself also probably goes somewhere... but since I don't currently have VB installed, I can't say for sure.

There're also Left() and Right() I think Confused If you need to cut a side off or something
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Display posts from previous:   
   Index -> Programming, Visual Basic and Other Basics -> Visual Basic Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 2 Posts ]
Jump to:   


Style:  
Search: