Forum Discussion

ramato's avatar
ramato
New Contributor
15 years ago

[Resolved] Truncating property string

I have a project property that I need to shorten. I am guessing I might do it in a groovy script through some string manipulation.

Project Property
projSerialNumber
123-123-44456
Lets say I wanted to drop the last two digits every time I called this script so the above example would become
123-123-444

What do I need to add?
context.expand( '${#Project#projSerialNumber}' )

note:the digits are random and the last two will not always be 56

1 Reply

  • ramato's avatar
    ramato
    New Contributor
    String sn = context.expand( '${#Project#projSerialNumber}' )
    sn.substring(0,11);