[Javascript] Truncate strings

flavio flavio at economisa.com.br
Fri Mar 19 15:31:27 CST 2004


My mistake:

 replace  "something.substr" to "yourString.substr";

and yeah, w3schools.com rules.. o.O (I'm reading wml there.. and wmlScript)


Quoting flavio <flavio at economisa.com.br>:

> 
> 
> Was it tested? 
> It haven't worked for me..
> 
> 
> But that another one worked:
> 
> var yourString = 'My Mail Box';
> var yourStringTruncated = something.substr(3, 4);
> 
>   If you want to search something inside the variable you must use 
> "stringObject.indexOf(searchString)" it returns the index of the first 
> searchString found (or lastIndexOf to get the last one) it returns -1 when
> not 
> found.
> 
> Hope to help,
> --
> Flavio Gomes
> flavio at economisa.com.br
> 
> Citando "Roberts, Mark (Tulsa)" <Mark.Roberts at Williams.com>:
> 
> > One way would be to use
> > 
> > Variable = substr(variable,1,6);
> > 
> > 
> > Mark Roberts 
> > Sr. Systems Analyst 
> > 
> > 
> > -----Original Message-----
> > From: Innerlab [mailto:innerlab at hotmail.com]
> > Sent: Friday, March 19, 2004 2:08 PM
> > To: [JavaScript List]
> > Subject: [Javascript] Truncate strings
> > 
> > How do you truncate a string to a certain number of characters?
> > 
> > Thanks
> > 
> > Ed.
> > _______________________________________________
> > Javascript mailing list
> > Javascript at LaTech.edu
> > https://lists.LaTech.edu/mailman/listinfo/javascript
> > _______________________________________________
> > Javascript mailing list
> > Javascript at LaTech.edu
> > https://lists.LaTech.edu/mailman/listinfo/javascript
> > 
> 
> 
> 
> 
> ---------------------------------------------------------------------
> Mensagem enviada através do WebMail NetSol (http://www.netsol.psi.br)
> _______________________________________________
> Javascript mailing list
> Javascript at LaTech.edu
> https://lists.LaTech.edu/mailman/listinfo/javascript
> 




---------------------------------------------------------------------
Mensagem enviada através do WebMail NetSol (http://www.netsol.psi.br)



More information about the Javascript mailing list