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
  1. Home
  2. General Programming
  3. C#
  4. String Manipulation

String Manipulation

Scheduled Pinned Locked Moved C#
xmlhelptutorial
10 Posts 7 Posters 0 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.
  • C Offline
    C Offline
    CoderOnline
    wrote on last edited by
    #1

    I Have a string

    <Parameters>
    <UserProfileState>0</UserProfileState>
    <Parameter>
    <Name>Report_Parameter_0</Name>
    <Type>String</Type>
    <Nullable>False</Nullable>
    <AllowBlank>True</AllowBlank>
    <MultiValue>False</MultiValue>
    <UsedInQuery>False</UsedInQuery>
    <State>MissingValidValue</State>
    <Prompt>Report_Parameter_0</Prompt>
    <DynamicPrompt>False</DynamicPrompt>
    <PromptUser>True</PromptUser> </Parameter>
    <Parameter> <Name>Report_Parameter_1</Name>
    <Type>String</Type> <Nullable>False</Nullable>
    <AllowBlank>True</AllowBlank>
    <MultiValue>False</MultiValue>
    <UsedInQuery>False</UsedInQuery>
    <State>MissingValidValue</State>
    <Prompt>Report_Parameter_1</Prompt>
    <DynamicPrompt>False</DynamicPrompt>
    <PromptUser>True</PromptUser>
    </Parameter> </Parameters>

    I want to do string manipulation with this and i want to <Name>Report_Parameter_0</Name> they are 2 its not xml ..! how to do in good method.! any help is greatly appreciated..!

    A P S P R 5 Replies Last reply
    0
    • C CoderOnline

      I Have a string

      <Parameters>
      <UserProfileState>0</UserProfileState>
      <Parameter>
      <Name>Report_Parameter_0</Name>
      <Type>String</Type>
      <Nullable>False</Nullable>
      <AllowBlank>True</AllowBlank>
      <MultiValue>False</MultiValue>
      <UsedInQuery>False</UsedInQuery>
      <State>MissingValidValue</State>
      <Prompt>Report_Parameter_0</Prompt>
      <DynamicPrompt>False</DynamicPrompt>
      <PromptUser>True</PromptUser> </Parameter>
      <Parameter> <Name>Report_Parameter_1</Name>
      <Type>String</Type> <Nullable>False</Nullable>
      <AllowBlank>True</AllowBlank>
      <MultiValue>False</MultiValue>
      <UsedInQuery>False</UsedInQuery>
      <State>MissingValidValue</State>
      <Prompt>Report_Parameter_1</Prompt>
      <DynamicPrompt>False</DynamicPrompt>
      <PromptUser>True</PromptUser>
      </Parameter> </Parameters>

      I want to do string manipulation with this and i want to <Name>Report_Parameter_0</Name> they are 2 its not xml ..! how to do in good method.! any help is greatly appreciated..!

      A Offline
      A Offline
      Abhinav S
      wrote on last edited by
      #2

      Can you use C# regular expressions for this?

      C 1 Reply Last reply
      0
      • A Abhinav S

        Can you use C# regular expressions for this?

        C Offline
        C Offline
        CoderOnline
        wrote on last edited by
        #3

        Ty For Your Reply..! How Can i get the value of

        <<Name>Report_Parameter_0</Name>

        Report_Parameter_0 for this one..!

        A V 2 Replies Last reply
        0
        • C CoderOnline

          Ty For Your Reply..! How Can i get the value of

          <<Name>Report_Parameter_0</Name>

          Report_Parameter_0 for this one..!

          A Offline
          A Offline
          Abhinav S
          wrote on last edited by
          #4

          I guess if you could get down to <<Name>Report_Parameter_0</Name> using regular expressions or otherwise, you could then just use a strings substring or indexOf property to parse the parameter. Report_parameter_o is actually an xml string, so you could even try using XDocument document = XDocument.Parse(xmlString); via Linq. I have not tried that myself, so please dont screw me if it does not work :) .

          C 1 Reply Last reply
          0
          • A Abhinav S

            I guess if you could get down to <<Name>Report_Parameter_0</Name> using regular expressions or otherwise, you could then just use a strings substring or indexOf property to parse the parameter. Report_parameter_o is actually an xml string, so you could even try using XDocument document = XDocument.Parse(xmlString); via Linq. I have not tried that myself, so please dont screw me if it does not work :) .

            C Offline
            C Offline
            CoderOnline
            wrote on last edited by
            #5

            Abhinav S wrote:

            so please dont screw me if it does not

            LoL :laugh: Thanks For Your suggestion i will try..!:cool:

            1 Reply Last reply
            0
            • C CoderOnline

              Ty For Your Reply..! How Can i get the value of

              <<Name>Report_Parameter_0</Name>

              Report_Parameter_0 for this one..!

              V Offline
              V Offline
              vivasaayi
              wrote on last edited by
              #6

              Hi 1. The string you posted is a valid XML. So why can't you load the string into an XML Document and navigate through the Child Nodes? 2. Or Use good old plain string matcing. Find the Start Index of <Name> and </name>. Then get the substring. 3. Use Regular Expressions

              1 Reply Last reply
              0
              • C CoderOnline

                I Have a string

                <Parameters>
                <UserProfileState>0</UserProfileState>
                <Parameter>
                <Name>Report_Parameter_0</Name>
                <Type>String</Type>
                <Nullable>False</Nullable>
                <AllowBlank>True</AllowBlank>
                <MultiValue>False</MultiValue>
                <UsedInQuery>False</UsedInQuery>
                <State>MissingValidValue</State>
                <Prompt>Report_Parameter_0</Prompt>
                <DynamicPrompt>False</DynamicPrompt>
                <PromptUser>True</PromptUser> </Parameter>
                <Parameter> <Name>Report_Parameter_1</Name>
                <Type>String</Type> <Nullable>False</Nullable>
                <AllowBlank>True</AllowBlank>
                <MultiValue>False</MultiValue>
                <UsedInQuery>False</UsedInQuery>
                <State>MissingValidValue</State>
                <Prompt>Report_Parameter_1</Prompt>
                <DynamicPrompt>False</DynamicPrompt>
                <PromptUser>True</PromptUser>
                </Parameter> </Parameters>

                I want to do string manipulation with this and i want to <Name>Report_Parameter_0</Name> they are 2 its not xml ..! how to do in good method.! any help is greatly appreciated..!

                P Offline
                P Offline
                puri keemti
                wrote on last edited by
                #7

                This is xml file. you can use xml object to find the parameters.......

                1 Reply Last reply
                0
                • C CoderOnline

                  I Have a string

                  <Parameters>
                  <UserProfileState>0</UserProfileState>
                  <Parameter>
                  <Name>Report_Parameter_0</Name>
                  <Type>String</Type>
                  <Nullable>False</Nullable>
                  <AllowBlank>True</AllowBlank>
                  <MultiValue>False</MultiValue>
                  <UsedInQuery>False</UsedInQuery>
                  <State>MissingValidValue</State>
                  <Prompt>Report_Parameter_0</Prompt>
                  <DynamicPrompt>False</DynamicPrompt>
                  <PromptUser>True</PromptUser> </Parameter>
                  <Parameter> <Name>Report_Parameter_1</Name>
                  <Type>String</Type> <Nullable>False</Nullable>
                  <AllowBlank>True</AllowBlank>
                  <MultiValue>False</MultiValue>
                  <UsedInQuery>False</UsedInQuery>
                  <State>MissingValidValue</State>
                  <Prompt>Report_Parameter_1</Prompt>
                  <DynamicPrompt>False</DynamicPrompt>
                  <PromptUser>True</PromptUser>
                  </Parameter> </Parameters>

                  I want to do string manipulation with this and i want to <Name>Report_Parameter_0</Name> they are 2 its not xml ..! how to do in good method.! any help is greatly appreciated..!

                  S Offline
                  S Offline
                  sashidhar
                  wrote on last edited by
                  #8

                  Answer is Here..! http://www.codeproject.com/Messages/3293369/Re-Regular-Expression-or-strin-manipulation.aspx[^]

                  LatestArticle :Log4Net Why Do Some People Forget To Mark as Answer .If It Helps.

                  1 Reply Last reply
                  0
                  • C CoderOnline

                    I Have a string

                    <Parameters>
                    <UserProfileState>0</UserProfileState>
                    <Parameter>
                    <Name>Report_Parameter_0</Name>
                    <Type>String</Type>
                    <Nullable>False</Nullable>
                    <AllowBlank>True</AllowBlank>
                    <MultiValue>False</MultiValue>
                    <UsedInQuery>False</UsedInQuery>
                    <State>MissingValidValue</State>
                    <Prompt>Report_Parameter_0</Prompt>
                    <DynamicPrompt>False</DynamicPrompt>
                    <PromptUser>True</PromptUser> </Parameter>
                    <Parameter> <Name>Report_Parameter_1</Name>
                    <Type>String</Type> <Nullable>False</Nullable>
                    <AllowBlank>True</AllowBlank>
                    <MultiValue>False</MultiValue>
                    <UsedInQuery>False</UsedInQuery>
                    <State>MissingValidValue</State>
                    <Prompt>Report_Parameter_1</Prompt>
                    <DynamicPrompt>False</DynamicPrompt>
                    <PromptUser>True</PromptUser>
                    </Parameter> </Parameters>

                    I want to do string manipulation with this and i want to <Name>Report_Parameter_0</Name> they are 2 its not xml ..! how to do in good method.! any help is greatly appreciated..!

                    P Offline
                    P Offline
                    PIEBALDconsult
                    wrote on last edited by
                    #9

                    It sure looks like XML to me. I'd use an XmlDocument or a Regular Expression.

                    1 Reply Last reply
                    0
                    • C CoderOnline

                      I Have a string

                      <Parameters>
                      <UserProfileState>0</UserProfileState>
                      <Parameter>
                      <Name>Report_Parameter_0</Name>
                      <Type>String</Type>
                      <Nullable>False</Nullable>
                      <AllowBlank>True</AllowBlank>
                      <MultiValue>False</MultiValue>
                      <UsedInQuery>False</UsedInQuery>
                      <State>MissingValidValue</State>
                      <Prompt>Report_Parameter_0</Prompt>
                      <DynamicPrompt>False</DynamicPrompt>
                      <PromptUser>True</PromptUser> </Parameter>
                      <Parameter> <Name>Report_Parameter_1</Name>
                      <Type>String</Type> <Nullable>False</Nullable>
                      <AllowBlank>True</AllowBlank>
                      <MultiValue>False</MultiValue>
                      <UsedInQuery>False</UsedInQuery>
                      <State>MissingValidValue</State>
                      <Prompt>Report_Parameter_1</Prompt>
                      <DynamicPrompt>False</DynamicPrompt>
                      <PromptUser>True</PromptUser>
                      </Parameter> </Parameters>

                      I want to do string manipulation with this and i want to <Name>Report_Parameter_0</Name> they are 2 its not xml ..! how to do in good method.! any help is greatly appreciated..!

                      R Offline
                      R Offline
                      Ravi Bhavnani
                      wrote on last edited by
                      #10

                      This[^] article may help. /ravi

                      My new year resolution: 2048 x 1536 Home | Articles | My .NET bits | Freeware ravib(at)ravib(dot)com

                      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