1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Need simple task from programer

Discussion in 'General Programming Chat' started by mladja3, Jul 10, 2014.

  1. mladja3

    mladja3 Regular Member

    Joined:
    Mar 14, 2013
    Messages:
    353
    Likes Received:
    34
    Location:
    Yugoslavia
    Hello. Im currently on a college for programer but im not very good at it. I have exam next week, and it will be similar task like this. "Replace all letters Y with letters W in a text using sub programs". Can anyone write me how that code should look? You will be a life savour.
     
  2. Macthetrix

    Macthetrix Regular Member

    Joined:
    Feb 21, 2013
    Messages:
    379
    Likes Received:
    390
    Occupation:
    The Boss
    Location:
    Silicon Valley
    string text = "Yo Im cool";
    string output = text.Replace("Y","W");
     
    • Thanks Thanks x 1
  3. Tanckom

    Tanckom Power Member

    Joined:
    May 4, 2014
    Messages:
    570
    Likes Received:
    172
    Location:
    ☯ Karma ☯
    Home Page:
    What language are you using? Java, C++, python..?
     
    • Thanks Thanks x 1
  4. ImacrosGuy

    ImacrosGuy BANNED BANNED

    Joined:
    Apr 20, 2014
    Messages:
    56
    Likes Received:
    43

    Use global, friend. He asked for "Replace all letters Y".

    Code:
    string output = text.Replace(/Y/g,"W"); 
     
    • Thanks Thanks x 2
  5. mladja3

    mladja3 Regular Member

    Joined:
    Mar 14, 2013
    Messages:
    353
    Likes Received:
    34
    Location:
    Yugoslavia
    Thank you all for help. Im using Basic. So this is okay for Basic?
     
  6. bartosimpsonio

    bartosimpsonio Jr. VIP Jr. VIP Premium Member

    Joined:
    Mar 21, 2013
    Messages:
    8,883
    Likes Received:
    7,481
    Occupation:
    ZLinky2Buy SEO Services
    Location:
    ⇩⇩⇩⇩⇩⇩⇩⇩⇩⇩⇩⇩
    Home Page:
    What version of Basic?

    Any way, search for basic regular expressions. What you need is s/Y/W/g - you should be able to translate that to any language that has regular expressions
     
    • Thanks Thanks x 1
  7. mladja3

    mladja3 Regular Member

    Joined:
    Mar 14, 2013
    Messages:
    353
    Likes Received:
    34
    Location:
    Yugoslavia
    Hey guys i have one more task, this one is little harder. Can someone do this in Basic, and just copy paste it here? I promise this is the last one. Thanks alott!!!
    [​IMG]
     
  8. innosoft

    innosoft Jr. VIP Jr. VIP Premium Member

    Joined:
    Nov 25, 2008
    Messages:
    1,633
    Likes Received:
    639
    Occupation:
    Software Developer, SEO
    Location:
    Office
    Home Page:
    i would really suggest you to study atleast something ;)

    they are really interesting and like girl friends once you start loving them!!!!


    Just my 6 yrs exp ;)
     
    • Thanks Thanks x 1
  9. k0d3r

    k0d3r Newbie

    Joined:
    Feb 17, 2013
    Messages:
    36
    Likes Received:
    28
    Location:
    Keyboard
    Why don't you try first and than use the forum to ask for help when you have doubts?

    Don't take me bad, but just posting your task here and wait for someone to post the answer will not work on the long term.
     
    • Thanks Thanks x 1
  10. mladja3

    mladja3 Regular Member

    Joined:
    Mar 14, 2013
    Messages:
    353
    Likes Received:
    34
    Location:
    Yugoslavia
    I already passed half of exam which are elementary things of programing but these sub programs i really dont get. And it will help me because this is the only year i have programing and i dont want to be programer, so i just want to pass this sub programs and im done.
     
  11. mladja3

    mladja3 Regular Member

    Joined:
    Mar 14, 2013
    Messages:
    353
    Likes Received:
    34
    Location:
    Yugoslavia
    Someone please?
     
  12. aqibarif74

    aqibarif74 Jr. VIP Jr. VIP Premium Member

    Joined:
    Jan 20, 2013
    Messages:
    1,850
    Likes Received:
    468
    Occupation:
    Founder of Aheadhost.com
    Home Page:
    Are you sure?? :eek:
     
  13. SliceGFX

    SliceGFX Newbie

    Joined:
    Dec 16, 2009
    Messages:
    16
    Likes Received:
    4
    How are your exams this easy? Wish my uni exams were this simple.