trim whitespace in Chat

Get the scoop on the changes happening here at CAA. You may also suggest changes or additions to the site and provide feedback about the board.

trim whitespace in Chat

Postby TurkishMonky » Wed Dec 14, 2005 3:18 pm

hey, if you think if it's possible, could you add in a little utility to trim all whitespace in the chat to 1 space? if you put in enough spaces and a <username>, it will wrap. i mean, it's fun to do and all, but occasionally it can get annoying...
User avatar
TurkishMonky
 
Posts: 808
Joined: Mon Apr 11, 2005 8:07 am

Postby Slater » Wed Dec 14, 2005 3:24 pm

hmm... that sounds pretty easy as long as Mithrandir has the source to the .class files. Trimming whitespaces is an easy task in Java.
Image
User avatar
Slater
 
Posts: 2671
Joined: Sat May 22, 2004 10:00 am
Location: Pacifica, Caliphornia

Postby Mithrandir » Sun Dec 18, 2005 10:40 pm

Heh. Sure, I *could* do that. It's easier not to, though. I'm pretty much through with the java chat. I'm working on a new and improved one that won't require java, though.
User avatar
Mithrandir
 
Posts: 11071
Joined: Fri Jun 27, 2003 12:00 pm
Location: You will be baked. And then there will be cake.

Postby Slater » Sun Dec 18, 2005 11:45 pm

I could help with the process if you want. One question though... what exactly is the problem with whitespaces? too many in front of a message or at the end of a message?

hmm... in any event, multiple whitespaces aren't really that useful. One can use the Wrapper class to check to see if there are, say, 3 or more whitespaces in a row in a string sent by a user, then trim them out and replace them with a single space...
Image
User avatar
Slater
 
Posts: 2671
Joined: Sat May 22, 2004 10:00 am
Location: Pacifica, Caliphornia

Postby TurkishMonky » Mon Dec 19, 2005 12:42 pm

Slater wrote:I could help with the process if you want. One question though... what exactly is the problem with whitespaces? too many in front of a message or at the end of a message?


the "hack" goes as follows (using - for spaces for the puropse of this example)
i type in:

hello--------------------------------------<MyFriend>-hi

becomes

<TurkishMonky> hello
<MyFriend> hi

it's mostly harmless, until people start getting annoying with it, especially in the instances of doing multiple posts, ...

hello----------------------------------------<TurkishMonky>-hi----------------------------------<MyFriend> -hola.
<OriginalPerson> hello
<TurkishMonky> hi
<MyFriend> hola.

but it's not that big a deal, if it's that hard to do.
User avatar
TurkishMonky
 
Posts: 808
Joined: Mon Apr 11, 2005 8:07 am

Postby Mithrandir » Thu Dec 22, 2005 10:20 am

Heh. What version of Java are you refering to, Slater. I'd find it much simpler to sub in a regex of some type. I don't know if java supports it or not, though. I'm not much of a java programmer. I'm envisioning something like s/\s+/\s/g working quite nicely.
User avatar
Mithrandir
 
Posts: 11071
Joined: Fri Jun 27, 2003 12:00 pm
Location: You will be baked. And then there will be cake.

Postby Slater » Sat Dec 24, 2005 1:35 pm

oooh, I see.
And I've been studying Java 5.0... last time I looked at the chat's source, I didn't notice if it used 1.4 imports versus 5.0 imports.
But what's a regex?
Image
User avatar
Slater
 
Posts: 2671
Joined: Sat May 22, 2004 10:00 am
Location: Pacifica, Caliphornia


Return to Announcements and Feedback

Who is online

Users browsing this forum: No registered users and 87 guests