Hi,
What is the function I can use to strip last char from string/value?
I am getting the value from "Time Spent" field. Users will enter time in H or week or days so I would like to get only number from it.
Thanks,
Om
Hi @Omprakash Thamsetty
You don't need to. Try this method on the issue object.
issue.getTimeSpent()
I hope it helps.
Ravi
Hi @Ravi Sagar _Sparxsys_ issue.getTimeSpent() will give us underlying issue value but I am getting the value for Time Spent from "log work" screen in behavior. So it is giving the value as 1h , if user enter 1 hour. I need to strip the H letter and get 1.
Oh ok. What about something like
string.substring(0, string.length()-1)
Let me know.
Seeing error. Look like subString doesn't like in behavior it seems.
def tmspentIDfld = getFieldById("timeLogged") //during the log work screen.def tmspentIDfldVal = tmspentIDfld.getValue()
def length = tmspentIDfldVal.substring(0, tmspentIDfldVal.length()-1)
It looks like you're new here. Sign in or register to get started.