Really Long Strings: Issues & Solutions

  • Thread starter Hurkyl
  • Start date
In summary, last night there was a very long thread title and today there was a very long username, both of which messed up the screen layout. It would be difficult to cap their display to a fixed length or forcibly wrap them, as a max of 15 characters is already in place for usernames. It may be possible to change a template to allow for wrapping, but this may not work for long strings without spaces. The issue with long usernames from newsgroups only seems to occur occasionally.
  • #1
Hurkyl
Staff Emeritus
Science Advisor
Gold Member
14,981
26
We had an example last night of a thread title that was very long, and today we have an example of a username that is very long. Both got displayed in full, messing up the screen layout: the former expanded the width of the page, and the latter consumed a high percentage of the width.

Would it be difficult to cap the display of such things to a fixed length, or at least forcibly wrap them?
 
Physics news on Phys.org
  • #2
We do have a max of I think 15 characters for a username. I think it would be difficult to dynamicly wrap a string depending on the postbit width. Does it happen often?
 
  • #3
Greg,

It might be as easy as changing a template to allow a table cell to wrap. I think this happens on e.g. the new posts page, and is typically due to the long usernames allowed on usenet posts.

- Warren
 
  • #4
chroot said:
Greg,

It might be as easy as changing a template to allow a table cell to wrap. I think this happens on e.g. the new posts page, and is typically due to the long usernames allowed on usenet posts.

- Warren

A table can't wrap if the string is really long, wrapping only works if there is a long sentance with spaces. So it would require some coding.
 
  • #5
Greg Bernhardt said:
We do have a max of I think 15 characters for a username. I think it would be difficult to dynamicly wrap a string depending on the postbit width. Does it happen often?

Unless spaces don't count, I think I got thorugh.
 
  • #6
The really long username did, in fact, come from the newsgroups. I've only seen it mess up the display once. (though the fact I'm on 1024x768 now probably had something to do with why I noticed)
 

1. What are really long strings and why are they an issue?

Really long strings refer to pieces of text or data that are significantly longer than the average length. They can be problematic because they can cause performance issues and consume a lot of memory when processing or manipulating them.

2. How do long strings affect the performance of a program?

Long strings can slow down the performance of a program because they require more memory to store and process. This can lead to longer execution times and delays in the program's response.

3. What are some common solutions for handling long strings?

One common solution is to break up the long string into smaller chunks, or substrings, to make it easier to process. Another solution is to use data compression techniques to reduce the size of the string without losing important information.

4. How can I prevent long strings from causing issues in my program?

One way to prevent issues with long strings is to set a limit on the maximum length allowed for a string. This can help avoid unexpected performance issues and ensure that the program runs efficiently.

5. Are there any programming languages that are better equipped to handle long strings?

Some programming languages, such as Python and JavaScript, have built-in methods and functions specifically designed for handling long strings. These languages also have features like automatic memory management that can help optimize the performance of programs when working with long strings.

Similar threads

Replies
47
Views
7K
Replies
58
Views
5K
  • General Discussion
Replies
4
Views
585
  • MATLAB, Maple, Mathematica, LaTeX
Replies
3
Views
204
  • Biology and Medical
Replies
2
Views
2K
Replies
1
Views
504
  • Art, Music, History, and Linguistics
Replies
1
Views
1K
Replies
4
Views
3K
  • High Energy, Nuclear, Particle Physics
Replies
1
Views
2K
  • General Discussion
Replies
4
Views
3K
Back
Top