CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 2005
    Posts
    141

    Identifying substrings in text

    I have a large string in which I need to replace specific strings with other values. For example, within this string I might see the following characters: [[sub id=5]]

    I am trying to replace those substrings with values, pulled from a table and based on the id. What would be the simplest way to accomplish this. My first thought was to loop through and examine each character and note their positions when they match the pattern. I would then have to identify the id. That would be fairly complicated, however, and there must be a better way. Any thoughts?

  2. #2
    Join Date
    Jul 2008
    Location
    WV
    Posts
    5,362

    Re: Identifying substrings in text

    Take a look at the replace function

  3. #3
    Join Date
    Sep 2007
    Posts
    82

    Re: Identifying substrings in text

    like DataMiser said use string.Replace()

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

Featured