+ Reply to Thread
Results 1 to 3 of 3

Thread: Strings

  1. #1
    clookid's Avatar
    clookid is offline Programmer
    Join Date
    Jan 2007
    Posts
    125
    Rep Power
    0

    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 09:50 PM.

  2. CODECALL Circuit advertisement
    Join Date
    Always
    Posts
    Many

     
  3. #2
    xtraze is offline Programming God
    Join Date
    Dec 2006
    Location
    Sri lanka
    Posts
    911
    Rep Power
    0
    I like the last one, " are needed when inserting variables, right.
    And who is the friend you are saying about, is he in codecall ?

  4. #3
    clookid's Avatar
    clookid is offline Programmer
    Join Date
    Jan 2007
    Posts
    125
    Rep Power
    0
    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. Beginner C# Strings
    By chili5 in forum CSharp Tutorials
    Replies: 3
    Last Post: 08-21-2011, 02:23 PM
  2. C Strings, C++ Strings?
    By telboon in forum C and C++
    Replies: 20
    Last Post: 11-20-2008, 06:16 PM
  3. Strings.
    By Aereshaa in forum C Tutorials
    Replies: 4
    Last Post: 10-15-2008, 05:45 AM
  4. VB Strings
    By reniery in forum Visual Basic Programming
    Replies: 10
    Last Post: 10-08-2008, 01:44 PM

Tags for this Thread

Bookmarks

Posting Permissions

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