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. Visual Basic
  4. Count a String using an integer; delete a character and then restart the count from next character

Count a String using an integer; delete a character and then restart the count from next character

Scheduled Pinned Locked Moved Visual Basic
helpquestion
4 Posts 4 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.
  • M Offline
    M Offline
    Manik Nath
    wrote on last edited by
    #1

    Hi All, I am facing a weird kinda problem. Can't figure the solution. Here is the problem. I have a string "FLAMES". This is a fixed string. I want to start counting the string characters till it reaches the value of an integer 'n' say the value of n = 7. So what I is want is the code to start counting from F,L,A,M,E,S now at n = 6 the string finishes, so n = 7 will be "F". Now at the last count of n whatever alphabet is there it should get scrapped off. In this case "F" gets scrapped off. The reamining string is "LAMES". Then restart the count from "L" till n = 7 and this time the alphabet that gets scrapped will be "A", the remaining string is "LMES" Again restart the count from next character which in this case is "M". Repeat this procedure untill there is only one alphabet remaining in "FLAMES". In this case of n = 7 it should be "E" Can anybody help in this? I'm really stuck at this. Thanks in advance for any help. Manik

    C S F 3 Replies Last reply
    0
    • M Manik Nath

      Hi All, I am facing a weird kinda problem. Can't figure the solution. Here is the problem. I have a string "FLAMES". This is a fixed string. I want to start counting the string characters till it reaches the value of an integer 'n' say the value of n = 7. So what I is want is the code to start counting from F,L,A,M,E,S now at n = 6 the string finishes, so n = 7 will be "F". Now at the last count of n whatever alphabet is there it should get scrapped off. In this case "F" gets scrapped off. The reamining string is "LAMES". Then restart the count from "L" till n = 7 and this time the alphabet that gets scrapped will be "A", the remaining string is "LMES" Again restart the count from next character which in this case is "M". Repeat this procedure untill there is only one alphabet remaining in "FLAMES". In this case of n = 7 it should be "E" Can anybody help in this? I'm really stuck at this. Thanks in advance for any help. Manik

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

      Sounds like some incredibly simple homework to me. We're not going to do it for you, you have to try yourself. It's set so you can learn, not because the world needs this program to exist. So, what have you tried ? Think about the task, think about how to logically break down the steps you want to take. If you're stuck when you bothered to try yourself, you might post code here and ask a SPECIFIC question.

      Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.

      1 Reply Last reply
      0
      • M Manik Nath

        Hi All, I am facing a weird kinda problem. Can't figure the solution. Here is the problem. I have a string "FLAMES". This is a fixed string. I want to start counting the string characters till it reaches the value of an integer 'n' say the value of n = 7. So what I is want is the code to start counting from F,L,A,M,E,S now at n = 6 the string finishes, so n = 7 will be "F". Now at the last count of n whatever alphabet is there it should get scrapped off. In this case "F" gets scrapped off. The reamining string is "LAMES". Then restart the count from "L" till n = 7 and this time the alphabet that gets scrapped will be "A", the remaining string is "LMES" Again restart the count from next character which in this case is "M". Repeat this procedure untill there is only one alphabet remaining in "FLAMES". In this case of n = 7 it should be "E" Can anybody help in this? I'm really stuck at this. Thanks in advance for any help. Manik

        S Offline
        S Offline
        Steven J Jowett
        wrote on last edited by
        #3

        Here is a tip... SubString

        Steve Jowett ------------------------- Real programmers don't comment their code. If it was hard to write, it should be hard to read.

        1 Reply Last reply
        0
        • M Manik Nath

          Hi All, I am facing a weird kinda problem. Can't figure the solution. Here is the problem. I have a string "FLAMES". This is a fixed string. I want to start counting the string characters till it reaches the value of an integer 'n' say the value of n = 7. So what I is want is the code to start counting from F,L,A,M,E,S now at n = 6 the string finishes, so n = 7 will be "F". Now at the last count of n whatever alphabet is there it should get scrapped off. In this case "F" gets scrapped off. The reamining string is "LAMES". Then restart the count from "L" till n = 7 and this time the alphabet that gets scrapped will be "A", the remaining string is "LMES" Again restart the count from next character which in this case is "M". Repeat this procedure untill there is only one alphabet remaining in "FLAMES". In this case of n = 7 it should be "E" Can anybody help in this? I'm really stuck at this. Thanks in advance for any help. Manik

          F Offline
          F Offline
          freakyit
          wrote on last edited by
          #4

          and the Second tip is ... .... using a loop :)

          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