Wont replace tabulator

This is a discussion on Wont replace tabulator within the C++ Programming forums, part of the General Programming Boards category; Code: for (int i = 1; i < Length; i++) { if (Text[i] == '\t') { Text[i] = ' '; ...

  1. #1
    Registered User
    Join Date
    Oct 2002
    Posts
    160

    Wont replace tabulator

    Code:
        for (int i = 1; i < Length; i++)
        {
          if (Text[i] == '\t')
          {
            Text[i] = ' ';
          }
        }
    How come that this code wont work. If Text haves one or more tabulators it don't find them and replace them with spaces. What am I doing wrong here?

    *Edit*

    BTW Text is an AnsiString (kind of like String) if that is of any importance.
    Well english isn't my first language, (it's instead a useless language called danish which only 5 milion people speak!!) so if you think my grammar SUCKS (it does by the way) than you're more then welcome to correct me.
    Hell I might even learn something

  2. #2
    Registered User
    Join Date
    Oct 2002
    Posts
    160
    And how do I do that?

    For some reason you have to start at 1 when working with AnsiString though its abnormal. Borlands help files says it too.
    Well english isn't my first language, (it's instead a useless language called danish which only 5 milion people speak!!) so if you think my grammar SUCKS (it does by the way) than you're more then welcome to correct me.
    Hell I might even learn something

  3. #3
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replace Array
    By SARAHCPS in forum C Programming
    Replies: 9
    Last Post: 11-15-2005, 11:07 AM
  2. Replace a list with a new entry?
    By niponki in forum C Programming
    Replies: 4
    Last Post: 08-17-2005, 11:41 AM
  3. Replies: 5
    Last Post: 05-25-2004, 05:36 PM
  4. How to replace strings in a file?
    By Doh in forum C Programming
    Replies: 6
    Last Post: 11-26-2002, 12:16 PM
  5. Need a new way to replace a constant
    By RustGod in forum C++ Programming
    Replies: 5
    Last Post: 10-29-2001, 03:05 PM

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