padding a string with spaces to the right 
Author Message
 padding a string with spaces to the right

strTest1 = "Jay"
response.write  left(strTest1 + Space(15), 15) + "hi!"

I wanted the above code to look like:     Jay            hi!
But instead it just does:   Jay hi!

So I'm not sure how to pad a string with spaces... anyone have any ideas?



Sat, 02 Aug 2003 01:43:10 GMT  
 padding a string with spaces to the right

Quote:
> I wanted the above code to look like:     Jay            hi!
> But instead it just does:   Jay hi!

HTML ignores multiple spaces so you have to force a space with " "
You can do something like this:

<%
strJay= "Hey" &  space(5) & "Jay"
strJay = Replace(myvar, Chr(32), "&nbsp;")
Response.write(strJay)
%>

where you replace ASCII spaces with "&nbsp;"
--
Jakob Andersen
Denmark
http://www.effectus.dk



Sat, 02 Aug 2003 03:25:52 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Problems w/ locking in 95 net

2. Right Padded Spaces in Fields (MSACCESS) when creating from VB6

3. Retrieve value of autoincrement field with inserted record

4. Dynamic var Type Re-assignment -- Integers -> Whatever ???

5. how to pad a string with spaces?

6. help padding a string w/ spaces

7. Newbie- Text Strings are padded w/ spaces.

8. Space Space Space Space Space Space Space

9. Space Space Space Space Space Space Space

10. Space Space Space Space Space Space Space

11. Table padding with spaces (Urgent)

12. Table padding with spaces (Urgent)

 

 
Powered by phpBB® Forum Software