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. A string thing i cannot figure out

A string thing i cannot figure out

Scheduled Pinned Locked Moved C#
testingtoolshelp
3 Posts 3 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.
  • S Offline
    S Offline
    sameerhanda
    wrote on last edited by
    #1

    :confused:I have an Excel automation engine that collects data from a specified cell in the Execel worksheet. Well when I get the data back and parse it based on a "," I get the following string from the worksheet "\"devbng:BNGDetail\"". Well I need to get rid of the '\' and the extra '"'. Well I have tried everything i could think of I wrote the following _serverName.Replace("\\",""); _serverName.Replace('\"',' '); But no avail, well any help would be greatly appreciated. Thanks

    C J 2 Replies Last reply
    0
    • S sameerhanda

      :confused:I have an Excel automation engine that collects data from a specified cell in the Execel worksheet. Well when I get the data back and parse it based on a "," I get the following string from the worksheet "\"devbng:BNGDetail\"". Well I need to get rid of the '\' and the extra '"'. Well I have tried everything i could think of I wrote the following _serverName.Replace("\\",""); _serverName.Replace('\"',' '); But no avail, well any help would be greatly appreciated. Thanks

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      There's a Remove method also, isn't there ? Christian Graus - Microsoft MVP - C++

      1 Reply Last reply
      0
      • S sameerhanda

        :confused:I have an Excel automation engine that collects data from a specified cell in the Execel worksheet. Well when I get the data back and parse it based on a "," I get the following string from the worksheet "\"devbng:BNGDetail\"". Well I need to get rid of the '\' and the extra '"'. Well I have tried everything i could think of I wrote the following _serverName.Replace("\\",""); _serverName.Replace('\"',' '); But no avail, well any help would be greatly appreciated. Thanks

        J Offline
        J Offline
        Jack Bond
        wrote on last edited by
        #3

        Ignore this entire post if _serverName is not a string object. Strings are immutable, so the code you have now is essentially a no-op, i.e. it's returning a new instance of a string that is not being stored by anything, and the original value of _serverName is unchanged. Have you tried: _serverName = _servername.Replace("\\", "");

        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