How to extract first 3 characters of jenkinsfile parameter

3k Views Asked by At

I need to extract the first 3 characters of jenkinsfile parameter:

string(name: 'DB_Type', defaultValue: 'mysql'  )

I tried the following but this did not work:

prefix=${params.db_type}
prefix=prefix.substring(0,2)

1

There are 1 best solutions below

0
On
params.DB_Type?.substring(0,3)