About us Privacy Disclaimer Contact us
FAQ Help Advertising Feedback
Home Sitemap Search Donate us

  Home > Computer & I'net > More Strings...

   Browse by title articles:
   What is hot:

Conditionals

Controls

More Strings

Comments

Subroutines

Forms & Hashes

DVD Backup Made Easy
Pop-Under Windows - The Latest Pop-Window Trend
Confirm
How to improve your search engine position
Prev articles123 4 56Next articles



More Strings


Computer & I'net articlesMore Strings

by David Stanley    



Time to re-examine strings. From an earlier tutorial page, its been noted that a string is simply a piece of data that contains letters and may contain numbers as well. Basically though, it is a non-fully-numeric piece of data. This page will show some different abilities you can do with strings.

Connecting or combining strings. JavaScript uses the + (plus) symbol to connect strings. Perl uses the . (period) symbol.

$firstname = "John";
$lastname = "Smith";
$fullname1 = $firstname . $lastname;
$fullname2 = $firstname . " " . $lastname;

$fullname1 has the value of "JohnSmith". The script literally combined the two scalar variables together. The second combining script line shows how to put a space in there. $fullname2 has the value of "John Smith".

Strings can have a repetition operator. That is the one string may be repeated (copied and combined) onto itself.

$result = "Dave" x 4;

The $result will contain the value "DaveDaveDaveDave"

Case operators control the CaSe LeTtErInG.

Case Op Escape Equivalent Result
lc L All letters in the string are converted to lower case.
lcfirst l Only the first letter in the string is converted to lowercase.
uc U All letters in the string are converted to upper case.
ucfirst u Only the first letter in the string id converted to uppercase.



-----------------

Article by David Stanley. Visit his site http://www.htmlite.com. Reprinted with permission.






Articles

Auto & Trucks

Business

Computer & I'net

  ·General

  ·Apache

  ·CSS

  ·Database

  ·Hardware

  ·HTML

  ·Javascript&DHTML

  ·Linux

  ·MySQL

  ·Operating System

Perl / CGI

  ·PHP

  ·Programming

  ·Publishing

  ·Search Engines

  ·Software Problems

  ·SSI

  ·Tips & Tricks

  ·Utilities

  ·Web Design

Family

Food & Drink

Gardening

Health

Other

Pets

Psychology

Spiritual

Travel

Women

 Calculators

Savings Estimator




  Disclaimer | Privacy | Terms of useCopyright © 2004 Nice2know.com