String index out of range: -2

robin
robin New Altair Community Member
edited November 2024 in Community Q&A

Is it poor form to request that when performing a cut, that we have the ability to select if the process should fail or if it should ignore an error when the data string is not long enough for the cut being requested?

Tagged:

Best Answers

  • robin
    robin New Altair Community Member
    Answer ✓

    The 'Cut' operator. If I have a string that I want cut out some information I put in the start and end position. The problem comes in if I set an end position and the string is shorter than the total length I set then the I get an 'index out of range' error. 

     

    Instead of firing the error I should be able to say do not fault if the string is shorter than the stipulated range. 

Answers

  • MartinLiebig
    MartinLiebig
    Altair Employee

    Hi @robin,

     

    what operator are you talking about? Sounds like an easy fix.

     

    BR,

    Martin

  • robin
    robin New Altair Community Member
    Answer ✓

    The 'Cut' operator. If I have a string that I want cut out some information I put in the start and end position. The problem comes in if I set an end position and the string is shorter than the total length I set then the I get an 'index out of range' error. 

     

    Instead of firing the error I should be able to say do not fault if the string is shorter than the stipulated range.