What is the use of limit in Split in String Operation

Hi, can anyone give me some examples what is the use of the limit section in Split in String Operation? Thanks!

Comments

  • Hi yf2zhang, the limit value can be used to control how many times to split a string that has multiple occurrences of the delimiter.

    For example:
    Your string contained 12#34#56#78#90
    Split has a delimiter of #
    Output is assigned to my-list-variable

    If you set Limit to -1, you split on every occurrence of the delimiter so your list variable would contain 5 items:

    12
    34
    56
    78
    90
    

    If you set the Limit to 2, your list variable would contain 2 items:

    12
    34#56#78#90
    

    If you set Limit to 4, your list variable would contain 4 items:

    12
    34
    56
    78#90
    

    Keep in mind that the Split Operation assigns output to a List Variable, so if you want to use the resulting split output you need to reference it by position in the list.

    Hope that makes sense.

  • @antony.askew said:
    Hi yf2zhang, the limit value can be used to control how many times to split a string that has multiple occurrences of the delimiter.

    For example:
    Your string contained 12#34#56#78#90
    Split has a delimiter of #
    Output is assigned to my-list-variable

    If you set Limit to -1, you split on every occurrence of the delimiter so your list variable would contain 5 items:

    12
    34
    56
    78
    90
    

    If you set the Limit to 2, your list variable would contain 2 items:

    12
    34#56#78#90
    

    If you set Limit to 4, your list variable would contain 4 items:

    12
    34
    56
    78#90
    

    Keep in mind that the Split Operation assigns output to a List Variable, so if you want to use the resulting split output you need to reference it by position in the list.

    Hope that makes sense.

  • 1567578
    In above string how to find sum

  • Your string contained 12#34#56#78#90
    so if you wanted to add that up just do a replace # with + and send it to a new variable
    I should work out the 'math' qs for you.
    In the same way that if I do a date like this 10/10/2000 it will give me the value of 10 divided by 10 divided by 2000
    If I wanted to use this date I would first need to set it using single ( or double) quotes round it and then do a separate find and replace for the quotes

Sign In or Register to comment.