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
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.
Thanks,
Om
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Oh ok. What about something like
string.substring(0, string.length()-1)
Let me know.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
What is the error?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Ravi Sagar _Sparxsys_ I converted as string once I got the value so it fixed the error. It was some data type.
so that code was
def tmspentIDfld = getFieldById("timeLogged") //during the log work screen.
def tmspentIDfldVal = tmspentIDfld.getValue().toString()
def length = tmspentIDfldVal.substring(0, tmspentIDfldVal.length()-1)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Great!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.