+ Reply to Thread
Results 1 to 3 of 3

Thread: Strings

  1. #1
    Programmer clookid is an unknown quantity at this point clookid's Avatar
    Join Date
    Jan 2007
    Posts
    125

    Strings

    Strings

    Strings are text, pure and simple. There's two ways of storing strings, inside single quotes and double-quotes. Using "double-quotes" allows you to use special characters like \n for a newline. The backslash character marks the next character as special, though the only characters you can backslash in 'single-quoted' strings are \' (a single quote) and \\ (a backslash).

    Some other special characters (for double-quoted strings)

    Code:
    t


    TAB

    n


    newline



    carriage-return. In DOS text-files, a new line is \r\n, though in practice in Windows you can get away with UNIX format, which is just \n

    Code:
    $


    $

    '


    '

    "



    The most important difference between single and double-quoted strings is that double-quoted strings can contain variable names:

    Code:
    $foo 'This doesn\'t work'// Oh yes it does!
    $foo "Matt's second line also works";

    $age 18;
    echo 
    'Bob is $age'// prints "Bob is $age"
    echo "Bob is $age"// prints "Bob is 18" 
    Check out the manual for more string stuff -- this is generally enough to get along with in daily use.

    This tutorial was written by another one of my friends, if you would like to use this tutorial please send me a PM
    Last edited by clookid; 01-10-2007 at 11:50 PM.

  2. #2
    Programming God xtraze is an unknown quantity at this point
    Join Date
    Dec 2006
    Location
    Sri lanka
    Posts
    908
    I like the last one, " are needed when inserting variables, right.
    And who is the friend you are saying about, is he in codecall ?

  3. #3
    Programmer clookid is an unknown quantity at this point clookid's Avatar
    Join Date
    Jan 2007
    Posts
    125
    No he is not in CodeCall, he is at another forum that I moderate.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Similar Threads

  1. Replies: 3
    Last Post: 05-18-2007, 12:27 PM
  2. VB strings to C DLL
    By malachi1984 in forum Visual Basic Programming
    Replies: 0
    Last Post: 05-11-2007, 05:36 AM
  3. Converting DB values into strings
    By ashleysmithd in forum Pascal/Delphi
    Replies: 5
    Last Post: 04-24-2007, 11:21 AM
  4. Combine two strings
    By Chan in forum PHP Forum
    Replies: 6
    Last Post: 09-29-2006, 06:02 PM

Bookmarks

Bookmarks

     
        Algorithms and Data Structures

        Java tutorials

        Algorithms Forum

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts