Remove End of Line Characters

Remove End of Line Characters

am 30.06.2008 19:24:33 von ajwei

Hi,

I have a simple file as follows:

There are in the total of 513 words in sinus.txt, lung.txt and stomach.txt.
151 sinus.txt
105 lung.txt
257 stomach.txt


What I want to do is to print the first line in the Description column, and=
have each of the following lines be entered into the database by assignin=
g the number as $words, and the filename into the Filename column.
The script in the following performs exactly the way I wanted, except for t=
he fact that in my database, each of the entries looks something like this:=
sinus.txt followed by a square for each of the variables that contains tex=
t. I don't have this problem for my numbers at all.

for ($i=3D1; $i <=3D 3; $i++) {

echo $i . ": " . $lines4[$i] . "\n";
list($words, $file) =3D explode(" ", $lines4[$i]);
echo "File: $file has $words words\n\n";
substr($file, 0, -3);
//substr($lines4['0'],0,-1);
$query3=3D"INSERT INTO youtoo(Description,Filename,Words) VALUES ('$lines4[=
0]','$file', '$words')";
$result1=3D mssql_query($query3) or die ("Couldn't Create New Entry into Da=
tabase $myDB");

}

I tried using rtrim(), chop() using the $line4 as I have declared and there=
is no use. Finally, I used substr(), but this does not seem to get what I =
wanted either, and the square is still in the way. I checked my text file i=
n the text editor, and I see nothing that could have produced the square du=
ring the database entering process.

Does anyone know what I have done wrong here? Anything is appreciated.


Alice
==================== =====3D=
==================== =====3D=
====
Alice Wei
MIS 2009
School of Library and Information Science
Indiana University Bloomington
ajwei@indiana.edu

--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

RE: Remove End of Line Characters

am 30.06.2008 19:41:35 von Zleviticus

My guess is that the squares are line feed or carriage returns. Do a
str_replace on \r and \n

-----Original Message-----
From: Wei, Alice J. [mailto:ajwei@indiana.edu]
Sent: Monday, June 30, 2008 1:25 PM
To: php-windows@lists.php.net
Subject: [PHP-WIN] Remove End of Line Characters

Hi,

I have a simple file as follows:

There are in the total of 513 words in sinus.txt, lung.txt and stomach.txt.
151 sinus.txt
105 lung.txt
257 stomach.txt


What I want to do is to print the first line in the Description column, and
have each of the following lines be entered into the database by assigning
the number as $words, and the filename into the Filename column.
The script in the following performs exactly the way I wanted, except for
the fact that in my database, each of the entries looks something like this:
sinus.txt followed by a square for each of the variables that contains text.
I don't have this problem for my numbers at all.

for ($i=1; $i <= 3; $i++) {

echo $i . ": " . $lines4[$i] . "\n";
list($words, $file) = explode(" ", $lines4[$i]);
echo "File: $file has $words words\n\n";
substr($file, 0, -3);
//substr($lines4['0'],0,-1);
$query3="INSERT INTO youtoo(Description,Filename,Words) VALUES
('$lines4[0]','$file', '$words')";
$result1= mssql_query($query3) or die ("Couldn't Create New Entry into
Database $myDB");

}

I tried using rtrim(), chop() using the $line4 as I have declared and there
is no use. Finally, I used substr(), but this does not seem to get what I
wanted either, and the square is still in the way. I checked my text file in
the text editor, and I see nothing that could have produced the square
during the database entering process.

Does anyone know what I have done wrong here? Anything is appreciated.


Alice
======================================================
Alice Wei
MIS 2009
School of Library and Information Science
Indiana University Bloomington
ajwei@indiana.edu

--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

RE: Remove End of Line Characters

am 30.06.2008 20:46:22 von ajwei

Hi,

for ($i=3D1; $i <=3D 3; $i++) {

echo $i . ": " . $lines4[$i] . "\n";
list($words, $file) =3D explode(" ", $lines4[$i]);
$carriage=3D array("\r\n", "\r", "\n");
str_replace($carriage, "", $lines4[$i]);
echo "File: $file has $words words\n\n";
$query3=3D"INSERT INTO youtoo(Description,Filename,Words) VALUES ('$lines4[=
0]','$file', '$words')";
$result1=3D mssql_query($query3) or die ("Couldn't Create New Entry into Da=
tabase $myDB");

}

Is this the change you told me to change? Or, am I having some other issue=
s here in this revised code?
I have just checked my database, and it is still giving me the same square.=
Could there be something else that I have missed?

Thanks for your help.

Alice
==================== =====3D=
==================== =====3D=
====
Alice Wei
MIS 2009
School of Library and Information Science
Indiana University Bloomington
ajwei@indiana.edu
________________________________________
From: Zephaniah ha Levi [zleviticus@fitnessnow.org]
Sent: Monday, June 30, 2008 1:41 PM
To: Wei, Alice J.; php-windows@lists.php.net
Subject: RE: [PHP-WIN] Remove End of Line Characters

My guess is that the squares are line feed or carriage returns. Do a
str_replace on \r and \n

-----Original Message-----
From: Wei, Alice J. [mailto:ajwei@indiana.edu]
Sent: Monday, June 30, 2008 1:25 PM
To: php-windows@lists.php.net
Subject: [PHP-WIN] Remove End of Line Characters

Hi,

I have a simple file as follows:

There are in the total of 513 words in sinus.txt, lung.txt and stomach.txt.
151 sinus.txt
105 lung.txt
257 stomach.txt


What I want to do is to print the first line in the Description column, and
have each of the following lines be entered into the database by assigning
the number as $words, and the filename into the Filename column.
The script in the following performs exactly the way I wanted, except for
the fact that in my database, each of the entries looks something like this=
:
sinus.txt followed by a square for each of the variables that contains text=
..
I don't have this problem for my numbers at all.

for ($i=3D1; $i <=3D 3; $i++) {

echo $i . ": " . $lines4[$i] . "\n";
list($words, $file) =3D explode(" ", $lines4[$i]);
echo "File: $file has $words words\n\n";
substr($file, 0, -3);
//substr($lines4['0'],0,-1);
$query3=3D"INSERT INTO youtoo(Description,Filename,Words) VALUES
('$lines4[0]','$file', '$words')";
$result1=3D mssql_query($query3) or die ("Couldn't Create New Entry into
Database $myDB");

}

I tried using rtrim(), chop() using the $line4 as I have declared and there
is no use. Finally, I used substr(), but this does not seem to get what I
wanted either, and the square is still in the way. I checked my text file i=
n
the text editor, and I see nothing that could have produced the square
during the database entering process.

Does anyone know what I have done wrong here? Anything is appreciated.


Alice
==================== =====3D=
==================== =====3D=
====
Alice Wei
MIS 2009
School of Library and Information Science
Indiana University Bloomington
ajwei@indiana.edu

--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: Remove End of Line Characters

am 30.06.2008 21:01:46 von Jacob Kruger

Are you using Jaws at all?

Not sure of other screenreaders, but in Jaws if you have the cursor on that
character, if you then hit the numpad 5 character 3 times quickly, it'll
return the character code for that character and you could then try replace
that character specifically as such?

Not 100% sure it'll work, and in some versions, I'm not 100% sure Jaws was
actually 'telling' you the correct character code, but Jaws 9 now seems
fine/accurate enough.

HTH

Jacob Kruger
Blind Biker
Skype: BlindZA
'...Fate had broken his body, but not his spirit...'

----- Original Message -----
From: "Wei, Alice J."
To: "Zephaniah ha Levi" ;

Sent: Monday, June 30, 2008 8:46 PM
Subject: RE: [PHP-WIN] Remove End of Line Characters


Hi,

for ($i=1; $i <= 3; $i++) {

echo $i . ": " . $lines4[$i] . "\n";
list($words, $file) = explode(" ", $lines4[$i]);
$carriage= array("\r\n", "\r", "\n");
str_replace($carriage, "", $lines4[$i]);
echo "File: $file has $words words\n\n";
$query3="INSERT INTO youtoo(Description,Filename,Words) VALUES
('$lines4[0]','$file', '$words')";
$result1= mssql_query($query3) or die ("Couldn't Create New Entry into
Database $myDB");

}

Is this the change you told me to change? Or, am I having some other issues
here in this revised code?
I have just checked my database, and it is still giving me the same square.
Could there be something else that I have missed?

Thanks for your help.

Alice
======================================================
Alice Wei
MIS 2009
School of Library and Information Science
Indiana University Bloomington
ajwei@indiana.edu
________________________________________
From: Zephaniah ha Levi [zleviticus@fitnessnow.org]
Sent: Monday, June 30, 2008 1:41 PM
To: Wei, Alice J.; php-windows@lists.php.net
Subject: RE: [PHP-WIN] Remove End of Line Characters

My guess is that the squares are line feed or carriage returns. Do a
str_replace on \r and \n

-----Original Message-----
From: Wei, Alice J. [mailto:ajwei@indiana.edu]
Sent: Monday, June 30, 2008 1:25 PM
To: php-windows@lists.php.net
Subject: [PHP-WIN] Remove End of Line Characters

Hi,

I have a simple file as follows:

There are in the total of 513 words in sinus.txt, lung.txt and stomach.txt.
151 sinus.txt
105 lung.txt
257 stomach.txt


What I want to do is to print the first line in the Description column, and
have each of the following lines be entered into the database by assigning
the number as $words, and the filename into the Filename column.
The script in the following performs exactly the way I wanted, except for
the fact that in my database, each of the entries looks something like this:
sinus.txt followed by a square for each of the variables that contains text.
I don't have this problem for my numbers at all.

for ($i=1; $i <= 3; $i++) {

echo $i . ": " . $lines4[$i] . "\n";
list($words, $file) = explode(" ", $lines4[$i]);
echo "File: $file has $words words\n\n";
substr($file, 0, -3);
//substr($lines4['0'],0,-1);
$query3="INSERT INTO youtoo(Description,Filename,Words) VALUES
('$lines4[0]','$file', '$words')";
$result1= mssql_query($query3) or die ("Couldn't Create New Entry into
Database $myDB");

}

I tried using rtrim(), chop() using the $line4 as I have declared and there
is no use. Finally, I used substr(), but this does not seem to get what I
wanted either, and the square is still in the way. I checked my text file in
the text editor, and I see nothing that could have produced the square
during the database entering process.

Does anyone know what I have done wrong here? Anything is appreciated.


Alice
======================================================
Alice Wei
MIS 2009
School of Library and Information Science
Indiana University Bloomington
ajwei@indiana.edu

--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: Remove End of Line Characters

am 01.07.2008 11:10:11 von Tularis

Wei, Alice J. wrote:
> Hi,
>
> for ($i=1; $i <= 3; $i++) {
>
> echo $i . ": " . $lines4[$i] . "\n";
> list($words, $file) = explode(" ", $lines4[$i]);
> $carriage= array("\r\n", "\r", "\n");
> str_replace($carriage, "", $lines4[$i]);
> echo "File: $file has $words words\n\n";
> $query3="INSERT INTO youtoo(Description,Filename,Words) VALUES ('$lines4[0]','$file', '$words')";
> $result1= mssql_query($query3) or die ("Couldn't Create New Entry into Database $myDB");
>
> }
>
> Is this the change you told me to change? Or, am I having some other issues here in this revised code?
> I have just checked my database, and it is still giving me the same square. Could there be something else that I have missed?
>
> Thanks for your help.
>
> Alice

You do realise that you're not assigning the result of the str_replace
to anything, right? Thus, the entire statement is basically... useless
(you're replacing all \r, \n, \r\n (this last one will never exist since
all \r and \n, including \r\n have already been replaced) in a copy of
$lines4[$i], and then never using that).

Please, post a couple of lines from the files and what you want them to
become (exactly). I'm a bit confused with just the "first line in the
Description column, and have each of the following lines be entered
into the database by assigning the number as $words, and the filename
into the Filename column" without being able to see what you're talking
about in the first place.

- Tul


--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

RE: Remove End of Line Characters

am 01.07.2008 12:40:17 von Zleviticus

she resolved issue yesterday by changing line:
str_replace($carriage, "", $lines4[$i]);

to

$lines4[$i] = str_replace($carriage, "", $lines4[$i]);



-----Original Message-----
From: M. Sokolewicz [mailto:tularis@php.net]
Sent: Tuesday, July 01, 2008 5:10 AM
To: Wei, Alice J.
Cc: Zephaniah ha Levi; php-windows@lists.php.net
Subject: Re: [PHP-WIN] Remove End of Line Characters

Wei, Alice J. wrote:
> Hi,
>
> for ($i=1; $i <= 3; $i++) {
>
> echo $i . ": " . $lines4[$i] . "\n";
> list($words, $file) = explode(" ", $lines4[$i]);
> $carriage= array("\r\n", "\r", "\n");
> str_replace($carriage, "", $lines4[$i]);
> echo "File: $file has $words words\n\n";
> $query3="INSERT INTO youtoo(Description,Filename,Words) VALUES
('$lines4[0]','$file', '$words')";
> $result1= mssql_query($query3) or die ("Couldn't Create New Entry into
Database $myDB");
>
> }
>
> Is this the change you told me to change? Or, am I having some other
issues here in this revised code?
> I have just checked my database, and it is still giving me the same
square. Could there be something else that I have missed?
>
> Thanks for your help.
>
> Alice

You do realise that you're not assigning the result of the str_replace
to anything, right? Thus, the entire statement is basically... useless
(you're replacing all \r, \n, \r\n (this last one will never exist since
all \r and \n, including \r\n have already been replaced) in a copy of
$lines4[$i], and then never using that).

Please, post a couple of lines from the files and what you want them to
become (exactly). I'm a bit confused with just the "first line in the
Description column, and have each of the following lines be entered
into the database by assigning the number as $words, and the filename
into the Filename column" without being able to see what you're talking
about in the first place.

- Tul


--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php