How do you represent tab as character or string?
How do you represent tab as character or string?
How do you represent tab as character or string?
How do you represent tab as character or string?
How do you represent tab as character or string?
How do you represent tab as character or string? How do you represent tab as character or string? How do you represent tab as character or string? How do you represent tab as character or string? How do you represent tab as character or string? How do you represent tab as character or string? How do you represent tab as character or string? How do you represent tab as character or string?
How do you represent tab as character or string? How do you represent tab as character or string?
How do you represent tab as character or string?
Go Back  Xtreme Visual Basic Talk > > > How do you represent tab as character or string?


Reply
 
Thread Tools Display Modes
  #1  
Old 08-18-2008, 08:27 AM
IndraG IndraG is offline
Junior Contributor
 
Join Date: Feb 2006
Posts: 204
Default How do you represent tab as character or string?


I have a string with tab in between, separating the characters such as:
"Andrew 8/14/2008 8 15"
I want to captured\ each of the substring. The way that I planned to do it is to first find out the index of the tabs using indexof method, and then using the substring method to cut the string into the parts that separated by the tab. My problem is that the indexof method takes char (or string) as its variable, and I am at loss at putting tab as char or string. Can anyone help?
Reply With Quote
  #2  
Old 08-18-2008, 08:30 AM
gpraceman's Avatar
gpracemanHow do you represent tab as character or string? gpraceman is offline
Contributor

* Expert *
 
Join Date: Sep 2002
Location: Highlands Ranch, CO
Posts: 560
Default

Why not just split on the tab? It is much less work.

Code:
Dim sValues() As String = sMyString.Split(vbTab)
You can also represent a tab with Chr(9) with 9 being the decimal value for the ascii tab character.
http://www.asciitable.com/
__________________
Awana Grand Prix and Pinewood Derby racing - Where a child, an adult and a small block of wood combine for a lot of fun and memories.
Reply With Quote
  #3  
Old 08-18-2008, 08:32 AM
AtmaWeapon's Avatar
AtmaWeaponHow do you represent tab as character or string? AtmaWeapon is offline
Fabulous Florist

Forum Leader
* Guru *
 
Join Date: Feb 2004
Location: Austin, TX
Posts: 9,500
Default

You have to use the vbTab identifier, or use the ASCII value for the tab character (9) to represent it with the Chr function.

Code:
Dim mystring As String = "test" & vbTab & "test"

Dim int As Integer = mystring.IndexOf(vbTab)
Console.WriteLine(int)
int = mystring.IndexOf(Chr(9))
Console.WriteLine(int)
Personally, I prefer vbTab; it is more clear and gives a C# programmer a fighting chance at reading your code. Some people have the common ASCII values memorized but others don't.
__________________
.NET Resources
My FAQ threads | Tutor's Corner | Code Library
I would bet money 2/3 of .NET questions are already answered in one of these three places.
Reply With Quote
  #4  
Old 08-19-2008, 06:34 AM
IndraG IndraG is offline
Junior Contributor
 
Join Date: Feb 2006
Posts: 204
Default

Gotcha! Thanks, guys
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
How do you represent tab as character or string?
How do you represent tab as character or string?
How do you represent tab as character or string? How do you represent tab as character or string?
How do you represent tab as character or string?
How do you represent tab as character or string?
How do you represent tab as character or string? How do you represent tab as character or string? How do you represent tab as character or string? How do you represent tab as character or string? How do you represent tab as character or string? How do you represent tab as character or string? How do you represent tab as character or string?
How do you represent tab as character or string?
How do you represent tab as character or string?
 
How do you represent tab as character or string?
How do you represent tab as character or string?
 
-->