Thread: Quick string question

  1. #1
    Registered User
    Join Date
    Nov 2001
    Posts
    19

    Quick string question

    How could I figure out if the last character in a string is a '&"? I've looked through all the string utilities, and I can't figure out an easy way to do this.
    Thanks

  2. #2
    Registered User
    Join Date
    Aug 2001
    Posts
    202
    go through it one character at a time, checking each char to see if it &, until you reach the end of line char.

    starX
    www.axisoftime.com

  3. #3
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,897
    Code:
    len = strlen ( array ) - 1;
    if ( array[len] == '&' )
      /* It is, do something */
    -Prelude
    My best code is written with the delete key.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Inheritance Hierarchy for a Package class
    By twickre in forum C++ Programming
    Replies: 7
    Last Post: 12-08-2007, 04:13 PM
  2. Replies: 4
    Last Post: 03-03-2006, 02:11 AM
  3. Quick, newbie question: Multiple line string
    By crummy in forum C# Programming
    Replies: 2
    Last Post: 03-10-2005, 06:58 AM
  4. Warnings, warnings, warnings?
    By spentdome in forum C Programming
    Replies: 25
    Last Post: 05-27-2002, 06:49 PM
  5. String array question
    By gogo in forum C++ Programming
    Replies: 6
    Last Post: 12-08-2001, 06:44 PM