473,396 Members | 2,109 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,396 software developers and data experts.

Embedding Non-Breakable Spaces into Strings -- How?

I have a list of variables and values (merge fields for a merge program) and
I want to put them in a list in a <SELECT> object. I'd like them to be
lined up, with an "=" midway between the field and the value. I was going
to fill the space between with spaces, but I noticed a number of spaces are
condensed to one (like in all other parts of HTML). I tried filling it
with non-breakable spaces, like this:

var line = "MyMergeField&nbsp;&nbsp;&nbsp;=&nbsp;&nbsp;&nbsp; MyValue";

And the non-breakable space is not interpreted -- it is entered into the
string literally. Is there a way to enter this character into a string?
Perhaps by hex value? Or is there some other way I can create spacing to
line up the equals signs so it looks good to users?

Thanks!

Hal
Jul 20 '05 #1
2 3566
Fox


Hal Vaughan wrote:

I have a list of variables and values (merge fields for a merge program) and
I want to put them in a list in a <SELECT> object. I'd like them to be
lined up, with an "=" midway between the field and the value. I was going
to fill the space between with spaces, but I noticed a number of spaces are
condensed to one (like in all other parts of HTML). I tried filling it
with non-breakable spaces, like this:

var line = "MyMergeField&nbsp;&nbsp;&nbsp;=&nbsp;&nbsp;&nbsp; MyValue";
var nbsp = String.fromCharCode(160);

line = nbsp + nbsp + MyValue;

And the non-breakable space is not interpreted -- it is entered into the
string literally. Is there a way to enter this character into a string?
Perhaps by hex value? Or is there some other way I can create spacing to
line up the equals signs so it looks good to users?
different fonts have differing spacing characteristics (no telling what
the user has set up) -- you might want to "force" a monospace font for
the style of the select.

I think Andale Mono will work, as will Courier New, but always fall back
on the generic "monospace" to make sure.
Thanks!

Hal

Jul 20 '05 #2
Fox wrote:


Hal Vaughan wrote:

I have a list of variables and values (merge fields for a merge program)
and
I want to put them in a list in a <SELECT> object. I'd like them to be
lined up, with an "=" midway between the field and the value. I was
going to fill the space between with spaces, but I noticed a number of
spaces are
condensed to one (like in all other parts of HTML). I tried filling it
with non-breakable spaces, like this:

var line = "MyMergeField&nbsp;&nbsp;&nbsp;=&nbsp;&nbsp;&nbsp; MyValue";
var nbsp = String.fromCharCode(160);

line = nbsp + nbsp + MyValue;


Thanks -- exactly what I needed!

And the non-breakable space is not interpreted -- it is entered into the
string literally. Is there a way to enter this character into a string?
Perhaps by hex value? Or is there some other way I can create spacing to
line up the equals signs so it looks good to users?


different fonts have differing spacing characteristics (no telling what
the user has set up) -- you might want to "force" a monospace font for
the style of the select.

I think Andale Mono will work, as will Courier New, but always fall back
on the generic "monospace" to make sure.


I already set that up, since the rest of my page is in Arial.
Thanks for the help!

Hal
Jul 20 '05 #3

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

Similar topics

4
by: Alicia Haumann | last post by:
I accidentally sent this to webmaster@python.org, so this could be a duplicate if "webmaster" forwards it to this list. :{ Hi, there. Thanks for any help that can be offered. I've been...
2
by: Roose | last post by:
With some googling I have found these resources: http://docs.python.org/ext/win-dlls.html http://www.python.org/doc/faq/windows.html I have a large Win32/MFC/C/C++ application that has an...
1
by: Craig Ringer | last post by:
Hi folks I'm a bit of a newbie here, though I've tried to appropriately research this issue before posting. I've found a lot of questions, a few answers that don't really answer quite what I'm...
0
by: Peter Jakubik | last post by:
Hi I am embedding Python 2.3.3 in C++ under Win2k. I am using in my App only Python DLL and empty site.py (so that User doesn't have to install Python). The Python Scripts contains Non-ASCII...
3
by: Gérard Talbot | last post by:
Hello all, When webfonts are used for purely cosmetic/ornemental reasons and on a large scale, I don't agree. When webfonts are used because Unicode support among browsers for a particular...
3
by: Marco Meoni | last post by:
Hi all! I've a problem with a C++ class that has to be included in a python application. One way to do it is Extending and Embedding the Python Interpreter Now i have 2 questions 1) Is there a...
0
by: hq4000 | last post by:
Given AStyleSheet.xsl : <AStyleSheet> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.mytest.mytest2.mytest3.com" version="1.0"> <xsl:output method="xml"...
6
by: Qun Cao | last post by:
Hi Everyone, I am a beginner on cross language development. My problem at hand is to build a python interface for a C++ application built on top of a 3D game engine. The purpose of this python...
6
by: mistabean | last post by:
Hello, first of all, I am a programming newbie, especially in python... Onwards to the problem, I have been having difficulty embedding a python module into my C/C++ program. (just a test...
3
by: dmoore | last post by:
Hi Folks: I have a question about the use of static members in Python/C extensions. Take the simple example from the "Extending and Embedding the Python Interpreter" docs: A simple module...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.