Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C#
  4. finding variables and method names in a source code

finding variables and method names in a source code

Scheduled Pinned Locked Moved C#
csharphelpquestion
3 Posts 3 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • E Offline
    E Offline
    emyl21
    wrote on last edited by
    #1

    hello everybody i need to build a small program in C# that searches within a C source code (a txt file basically) for variables and method names and after that to replace them with something else. i can't do the first part. i've tried to do something but with no success. can you help me with some informations/suggestions? thank you in advance

    D S 2 Replies Last reply
    0
    • E emyl21

      hello everybody i need to build a small program in C# that searches within a C source code (a txt file basically) for variables and method names and after that to replace them with something else. i can't do the first part. i've tried to do something but with no success. can you help me with some informations/suggestions? thank you in advance

      D Offline
      D Offline
      dan sh
      wrote on last edited by
      #2

      You must know all the keywords that can come before a variable or method name, like int, string etc. You will also need to check if the word there for variable declaration and elsewhere. ie word string might come in a comment text and then you will end up editing the comment. All I can suggest is to make sure you know what I have written above. Then you can just take the very next word and replace it.

      जय हिंद

      1 Reply Last reply
      0
      • E emyl21

        hello everybody i need to build a small program in C# that searches within a C source code (a txt file basically) for variables and method names and after that to replace them with something else. i can't do the first part. i've tried to do something but with no success. can you help me with some informations/suggestions? thank you in advance

        S Offline
        S Offline
        Samuel Cherinet
        wrote on last edited by
        #3

        list the possible keywords, and try building a regular expression for them, since every line should end with ";" it might loosen writing the a regular expression for it, but it will be a lil tough. good luck

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups