Trouble with substring

This is a discussion on Trouble with substring within the C++ Programming forums, part of the General Programming Boards category; Hello, I'am a totally newbie I tried all morning to get the firstletter from a string. AnsiString SomeText = DBEditVoornaam->Text; ...

  1. #1
    Registered User
    Join Date
    Jun 2002
    Posts
    3

    Trouble with substring

    Hello,

    I'am a totally newbie
    I tried all morning to get the firstletter from a string.

    AnsiString SomeText = DBEditVoornaam->Text;
    AnsiString FirstLetter;
    FirstLetter = SubString(0,1)SomeText;

    DBEditVoorletter->Text = FirstLetter;


    I looked in all the help files, but the compiler keeps saying undefined function Substring. (borland)
    I have include string.h in the header

    Can someone help me out, i'm getting desparate

  2. #2
    Registered User
    Join Date
    Apr 2002
    Posts
    362
    Try

    FirstLetter = SomeText.substr(0,1);

    -Skipper
    "When the only tool you own is a hammer, every problem begins to resemble a nail." Abraham Maslow

  3. #3
    ....
    Join Date
    Aug 2001
    Location
    Groningen (NL)
    Posts
    2,386
    Sure you use it the right way, shouldn't it be something like:

    FirstLetter = SomeText.SubString(0,1);

  4. #4
    Registered User
    Join Date
    Jun 2002
    Posts
    3
    thnx it works


    regards Martijn

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. split string and remove substring
    By nyc_680 in forum C Programming
    Replies: 3
    Last Post: 03-02-2009, 04:45 AM
  2. I need help with creating a substring program
    By CProgramingBegg in forum C Programming
    Replies: 9
    Last Post: 02-06-2009, 09:50 AM
  3. longest common substring problem
    By Enchanter88 in forum C++ Programming
    Replies: 4
    Last Post: 09-29-2007, 12:02 PM
  4. Replacing a substring with another
    By Dan17 in forum C Programming
    Replies: 3
    Last Post: 09-14-2006, 11:37 AM
  5. Replies: 11
    Last Post: 12-11-2005, 11:50 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21