Enter in a string

Questions, tips and tricks and techniques for scripting in Servoy

Enter in a string

Postby pbakker » Fri Feb 06, 2004 8:41 pm

Hi,

I created a method that makes a string from a dataset/Array. Between each record I put a \n to get the records in the string under each other ("simulate Enter", also tried \f and \r). Now, I'm experiencing the following problem:

When I copy the string into the ClipBoard and paste the ClipBoard into a textfile (I'm working on windows) all goes fine. I've I paste the string into a text area all goes fine, but if I write the string to a text file, using application.writeTXTFile, the different records are not under eachother, but on one line, separated by a little square box (viewed with NotePad on Windows)

From other experience I know this is a sort of Unix presentation. Anyone knows a sollution to solve this? Use something different to separate the records or a search and replace afterwards???

tnx in advance,

Paul
pbakker
 
Posts: 2822
Joined: Wed Oct 01, 2003 8:12 pm
Location: Amsterdam, the Netherlands

Postby IT2Be » Fri Feb 06, 2004 9:03 pm

If you just use it as a seperator why bother with its presentation? What happens when you read it back? Have you lost it '\n' then or is it gone? Is it notepad that changes this?

Normally such a thing happens on the mac, but here it is no problem...
Marcel J.G. Trapman (IT2BE)
SAN partner - Freelance Java and Servoy
Servoy Components - IT2BE Plug-ins and Beans for Servoy
ServoyForge - Open Source Components for Servoy
User avatar
IT2Be
Servoy Expert
 
Posts: 4766
Joined: Tue Oct 14, 2003 7:09 pm
Location: Germany

Postby pbakker » Fri Feb 06, 2004 11:20 pm

The little square represents "enter". If you would open the file in Wordpad or Word, it sees it as enter and the records are under eachother.

It's just in Notepad andjust a display issue. Because of this the file becomes unreadable in notepad, because all the lines are behind eachother, instead of under eachother. Even if I cut and paste the example into the forum, the little square box behaves as "Enter" again.

My issue with this is that Notepad is often used to check the content of flat text files, because it shows the file as it actually is, without formatting. This makes it easy to check things, especially when you get import errors importing such a file into Excel...

Anyway, if someone knows a sollution... (getting a bit sidetracked from Servoy here.. :-) )
pbakker
 
Posts: 2822
Joined: Wed Oct 01, 2003 8:12 pm
Location: Amsterdam, the Netherlands

Postby Jan Blok » Wed Feb 11, 2004 1:40 pm

On windows the line separator is actualy \n\r and some programs do indeed not accept only a \n
so try \n\r
Jan Blok
Servoy
Jan Blok
 
Posts: 2684
Joined: Mon Jun 23, 2003 11:15 am
Location: Amsterdam

Postby pbakker » Wed Feb 11, 2004 1:50 pm

:( tried it: now I just get two little squares.....
pbakker
 
Posts: 2822
Joined: Wed Oct 01, 2003 8:12 pm
Location: Amsterdam, the Netherlands

Postby pbakker » Wed Feb 11, 2004 1:52 pm

Hey, it works the other way around: \r\n

Thx Jan for getting me on my way!

Paul
pbakker
 
Posts: 2822
Joined: Wed Oct 01, 2003 8:12 pm
Location: Amsterdam, the Netherlands


Return to Methods

Who is online

Users browsing this forum: No registered users and 30 guests

cron