SPONSORS:






User Tag List

Results 1 to 8 of 8
  1. #1
    Senior Member
    Join Date
    Feb 2000
    Posts
    1,497
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Can SilkTest parse an integer from a string, like in java?

    GetField() can be used to quickly obtain substrings of the input data.

    Val() can be used to turn a string into an equivalent number.

    A combination of these could be used to parse the entire input and return a record having month, day, hour, minute and AP/PM fields.


    John


    ------------------

  2. #2
    Senior Member
    Join Date
    Jun 1999
    Location
    Fremont, CA, USA
    Posts
    355
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Can SilkTest parse an integer from a string, like in java?

    Here is a function that can get the first group of numbers out of a string. If the string is "I have $10, but need $20", it will return '10'.


    ------------------
    David Genrich
    david.genrich@e2open.com
    david@linuxpuppy.net

  3. #3
    Senior Member
    Join Date
    Oct 2001
    Location
    NC, United States
    Posts
    148
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Can SilkTest parse an integer from a string, like in java?

    sample code, let me know if it is to your requirement:

    [-] testcase ConvertDate() appstate none
    [ ] string sDate1 = "Nov-17 3:00 AM"
    [ ] string sDate2 = "Nov-17 3:05 AM"
    [ ]
    [ ] sDate1 = GetField(sDate1," ",2)
    [ ] sDate2 = GetField(sDate2," ",2)
    [ ]
    [ ] TIME tm1 = [TIME]sDate1
    [ ] TIME tm2 = [TIME]sDate2
    [ ]
    [ ] print(Val([string]tm2)-Val([string]tm1))
    [ ]


    ------------------
    -gram
    -gram

  4. #4
    Senior Member
    Join Date
    Jun 2002
    Posts
    119
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Can SilkTest parse an integer from a string, like in java?

    Excellent! I knew there had to be some way to do it. I looked for everything I could think of in the way of a name for a function. Val() didn't occur to me. Nothing in the index of the manual gave me a clue, either.

    Thanks!!!


    ------------------

  5. #5
    Senior Member
    Join Date
    Jun 2002
    Posts
    119
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Can SilkTest parse an integer from a string, like in java?

    I'm familiar with the java Integer.parseInt() method that can read a text string representing a number and return the actual integer value, such as getting input from a textfield. I want to be able to read a message off of a web app

    Last refreshed: Nov-15 02:09 PM

    After updating the page a minute later, it will read

    Last refreshed: Nov-15 02:10 PM

    I suppose I could verify that the refresh happens by comparing the two strings and if they are the same, the refresh didn't happen. But I'd really like to be able to set the refresh rate for 5 minutes, say, and get the message 5 minutes later, and be able to verify that it actually says 5 minutes later. I'd have to be able to parse out the numerical values to do that.

    Any hope? I can't find any leads yet in the Help or the manual

    ------------------

  6. #6
    Senior Member
    Join Date
    Jul 1999
    Location
    Bellingham, WA USA
    Posts
    1,323
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Can SilkTest parse an integer from a string, like in java?

    felecha,

    Use the Library Browser. It's an excellent resource for finding valid functions for various data types. I use it regularly! (Like flossing daily! )

    ------------------

  7. #7
    Member
    Join Date
    Sep 2002
    Location
    Foster City, CA, USA
    Posts
    55
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Can SilkTest parse an integer from a string, like in java?

    JGray, how did you get that smiley winking ball in there? That's pretty cute.

  8. #8
    Senior Member
    Join Date
    Jul 1999
    Location
    Bellingham, WA USA
    Posts
    1,323
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Can SilkTest parse an integer from a string, like in java?

    It's done by the site. Just type a semi-colon followed by a close-paren. The site will let you use a number of different emoticons.

    ------------------

 

 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

vBulletin Optimisation provided by vB Optimise v2.6.0 Beta 4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.0.9 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Questions / Answers Form provided by vBAnswers (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominatevBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Feedback Buttons provided by Advanced Post Thanks / Like (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 07:40 PM.

Copyright BetaSoft Inc.