Click here to Skip to main content
15,913,685 members
Home / Discussions / Web Development
   

Web Development

 
GeneralZero-length string Pin
Moonbrat1-Feb-04 6:11
Moonbrat1-Feb-04 6:11 
GeneralRe: Zero-length string Pin
Roger Wright1-Feb-04 7:12
professionalRoger Wright1-Feb-04 7:12 
GeneralRe: Zero-length string Pin
Moonbrat1-Feb-04 18:12
Moonbrat1-Feb-04 18:12 
GeneralRe: Zero-length string Pin
Moonbrat1-Feb-04 18:19
Moonbrat1-Feb-04 18:19 
GeneralRe: Zero-length string Pin
Roger Wright2-Feb-04 4:29
professionalRoger Wright2-Feb-04 4:29 
Generalclear chache from script Pin
Roland Bär1-Feb-04 2:29
Roland Bär1-Feb-04 2:29 
GeneralTrim$() in javascript Pin
Hesham Amin1-Feb-04 1:24
Hesham Amin1-Feb-04 1:24 
GeneralRe: Trim$() in javascript Pin
Roger Wright1-Feb-04 3:55
professionalRoger Wright1-Feb-04 3:55 
According to this handy JavaScript - The Definitive Guide book on my shelf, there is no such function. But it shouldn't be too difficult to write a function for this. Find the length of the string, then search character by character from the beginning and from the end of the string for the first non-space character position. Using two searches, rather than one forward search, allows you to preserve any contained spaces in the target string. Use the two positions as the indices for a call to string.substring(from, to+1) and return the result. Note the to+1 value for the second parameter. The .substring method returns characters up to the position before the the second index for some strange reason.

If you use this in more than a couple of pages in your project, stuff it in a SSI file and include it where you need it. Most of my projects have a util.asp file where miscellaneous workarounds live - someday I may even consolidate them into one generic include.Smile | :)

Heard in Bullhead City - "You haven't lost your girl -
you've just lost your turn..." [sigh] So true...
GeneralRe: Trim$() in javascript Pin
Nick Parker1-Feb-04 8:34
protectorNick Parker1-Feb-04 8:34 
GeneralRe: Trim$() in javascript Pin
Hesham Amin1-Feb-04 9:52
Hesham Amin1-Feb-04 9:52 
GeneralRe: Trim$() in javascript Pin
boogs2-Feb-04 9:12
boogs2-Feb-04 9:12 
GeneralRe: Trim$() in javascript Pin
theJazzyBrain2-Feb-04 21:24
theJazzyBrain2-Feb-04 21:24 
Questionhow to adjust line spacing within text? Pin
coda_x31-Jan-04 15:39
coda_x31-Jan-04 15:39 
AnswerRe: how to adjust line spacing within text? Pin
ZoogieZork31-Jan-04 19:41
ZoogieZork31-Jan-04 19:41 
GeneralCross domain DOM access for parent.frames[0].location.href Pin
Phil G31-Jan-04 2:28
Phil G31-Jan-04 2:28 
GeneralRe: Cross domain DOM access for parent.frames[0].location.href Pin
alex.barylski31-Jan-04 9:34
alex.barylski31-Jan-04 9:34 
Generalembedded media player... Pin
l a u r e n30-Jan-04 11:40
l a u r e n30-Jan-04 11:40 
GeneralRe: embedded media player... Pin
alex.barylski30-Jan-04 12:21
alex.barylski30-Jan-04 12:21 
GeneralRe: embedded media player... Pin
l a u r e n30-Jan-04 12:30
l a u r e n30-Jan-04 12:30 
Generaluse XMLHTTP Pin
Nathan Ridley31-Jan-04 12:33
Nathan Ridley31-Jan-04 12:33 
GeneralAligning with CSS Pin
srt730-Jan-04 7:51
srt730-Jan-04 7:51 
GeneralRe: Aligning with CSS Pin
theJazzyBrain1-Feb-04 0:43
theJazzyBrain1-Feb-04 0:43 
GeneralRe: Aligning with CSS Pin
DFU232-Feb-04 8:28
DFU232-Feb-04 8:28 
GeneralASP Session question... Pin
theJazzyBrain30-Jan-04 4:32
theJazzyBrain30-Jan-04 4:32 
GeneralRe: ASP Session question... Pin
l a u r e n30-Jan-04 11:35
l a u r e n30-Jan-04 11:35 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.