Results 1 to 4 of 4

Thread: String Replace??

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    May 2000
    Posts
    367

    String Replace??

    Does anyone have any code examples of string replace?

    I have a string of the following format :

    ABCDEF123456

    I need to get the ABCDEF to 0's (zeros) so it looks like :

    000000123456

    Any help is appreciated greatly

    Bill

  2. #2
    PowerPoster hellswraith's Avatar
    Join Date
    Jul 2002
    Location
    Washington St.
    Posts
    2,464
    string thestring = "ABCDEF123456";
    thestring = thestring.Replace("ABCDEF", "000000");

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    May 2000
    Posts
    367
    There is a replace function with string? Cool have to check that out I resorted to regex.

    pseuHalfWords[j-1] = Regex.Replace(pseuHalfWords[j-1], "ABC", "000");

    thanks hellswraith,
    Bill

  4. #4
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    Regular Expressions are probably a better idea still. The String.Replace method doesn't know any wildcards or such.
    replace "[A-F]" with "0"
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

Posting Permissions

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



Click Here to Expand Forum to Full Width