string help

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • rents
    New Member
    • Mar 2007
    • 26

    #1

    string help

    String string = "one,two,three, four,five";
    String[] tokens = string.split(", ");

    What is the value of tokens[2]?
    "one"
    "two"
    "three"
    "four"
    None of the above


    String string = "What is the position the number 2 in this string?";
    int pos = string.indexOf( "2");

    What is the value of pos?
    4
    16
    -1
    32
    None of the above
  • blazedaces
    Contributor
    • May 2007
    • 284

    #2
    Originally posted by rents
    String string = "one,two,three, four,five";
    String[] tokens = string.split(", ");

    What is the value of tokens[2]?
    "one"
    "two"
    "three"
    "four"
    None of the above
    "three"

    Originally posted by rents
    String string = "What is the position the number 2 in this string?";
    int pos = string.indexOf( "2");

    What is the value of pos?
    4
    16
    -1
    32
    None of the above
    32

    Why are you asking this?

    Comment

    • JosAH
      Recognized Expert MVP
      • Mar 2007
      • 11453

      #3
      Originally posted by blazedaces
      Why are you asking this?
      I'm so curious what you have won ;-)

      kind regards,

      Jos

      ps. I bet it was just homework and the OP was cheating.

      Comment

      • blazedaces
        Contributor
        • May 2007
        • 284

        #4
        Originally posted by JosAH
        I'm so curious what you have won ;-)

        kind regards,

        Jos

        ps. I bet it was just homework and the OP was cheating.
        I don't know why I didn't consider it yesterday but as soon as I as this thread again today I almost smacked myself...

        Still, today as well as yesterday, these two questions just seem so inherently stupid that to cheat on them is just pathetic... Maybe I'm being a bit harsh...

        -blazed

        Comment

        • JosAH
          Recognized Expert MVP
          • Mar 2007
          • 11453

          #5
          Originally posted by blazedaces
          I don't know why I didn't consider it yesterday but as soon as I as this thread again today I almost smacked myself...

          Still, today as well as yesterday, these two questions just seem so inherently stupid that to cheat on them is just pathetic... Maybe I'm being a bit harsh...

          -blazed
          No, you're not being harsh at all, a bit naive mayhap by helping the OP with his
          obvious questionaire (sp?) or his homework ;-)

          kind regards,

          Jos

          Comment

          Working...