473,386 Members | 1,621 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Replacing a TAB with 2 spaces

I'm having problems with UNICODE and ASCII here.
I'm trying to make a program that reads in a text file containing a
couple of columns of data. This data is separated by one tab. I want
to change that so that the output file is identical except that tab
is changed to 2 empty spaces (in between the data columns).

the snip of code is something like this:
StreamReader stream = new System.IO.StreamReader(filename);
string read = stream.ReadLine();

//This does not work
read.Replace("\09"," ");

//And neither does this
charData = new char[read.Length];
charData = read.ToCharArray();
m = charData.Length;
for(int i=0; i<m;i++)
{
if(charData[i] == '\09') //This part gives a
compile error
charData[i] = ' ';
}
Anyone know an easy way to do this ?
What am I doing wrong?
How can I include UNICODE in various string or char related functions?
Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
http://www.usenet.com
Nov 16 '05 #1
1 11824
Strings are immutable, so if you want to change the string, do it like
this:

read = read.Replace("\t", " ");

----
- Wilco Bauwer
Blog & Custom Controls @ http://wilcoding.xs4all.nl

Nov 16 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: jamesfin | last post by:
Dear XMLers, Please guide me... I have a simple xml file... <URLTest>
2
by: Philo Hippo | last post by:
Hi, I need to be able to remove spaces from the beginning or the end of a string. This is my very 1st attempt at doing that in JS and here is what i got: function SearchForDomains(winName,...
12
by: anonymous | last post by:
Hello, I need to replace this char  with another char. However I am not able to acieve this. I tried this but it doesnt work: str = str.Replace(chr(asc(194)), "") Can somebody help ?
3
by: James D. Marshall | last post by:
The issue at hand, I believe is my comprehension of using regular expression, specially to assist in replacing the expression with other text. using regular expression (\s*) my understanding is...
32
by: FireHead | last post by:
Hello C World & Fanatics I am trying replace fgets and provide a equavivalant function of BufferedInputReader::readLine. I am calling this readLine function as get_Stream. In the line 4 where...
2
by: David | last post by:
Sent this to alt.php a couple of days back, but doesn't look like I'll get an answer, so trying here. I'm trying to convert a script to use friendly URLs, I've done this before, but my PHP...
2
by: nobugus | last post by:
Hello, This might be more of a PHP-thing than REGEX, but here's my problem: I am using a HEX value to find and replace 'white spaces' with 'x': take this example: $string = preg_replace('//u',...
2
by: rjoseph | last post by:
Hi Guys I hope this is a simple one for you. I am basically displaying data onto my xml page using the following line of code: <xsl:value-of select="carmanufacturer" /> An example of the...
1
by: duncanm817 | last post by:
hi, I require some assistance in understanding how to accomplish replacing a particular hex value in a binary file on aix. in a binary file I need to find the following combination: 5A 00 10...
2
by: aqualuvaro | last post by:
Hi all, In advance, thanks for any help. I'm an absolute newbie to javascript so any help is much appreciated. (see code below) I have two html pages, form values are entered into one &...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.