Hi ,
In string first check do we have last comma or not if have then remove the last comma from the string.
eg. Table,Chair,Ball, - here last comma remove from this string
Hi, you can build a quick logic to get that, using Length() and Substr () built-in functions :)
You can check if your last char is a comma with this:
Substr("String",Length("String")-1,Length("String ")) = ","
If that's true, you can remove the last comma with this: Substr("String",0,Length("String")-1)
Hope this helps!
An alternative is using the Text API and try something like this assign:
testString
=
If(String_LastIndexOf(testString,",")= Length(testString)-1,
Substr(testString,0,Length(testString)-1)
,testString)
Regards
JP
Hello Preeti,
Are you building this string?
If so you can just add the "," before the new word, this way you will never have a "," at the end, just check if the String is empty first, and if it is don't add the "," to the first word.
"table" + ",chair" + ",ball" = "table,chair,ball"
Just another spin on it :)
If you are not building the string then I'm sure that Laura´s and José's answers will work for you!
Hope it helps!
Paulo Rosário
Here are your solution
character = str.charAt(str.length-1)
if( character == ',')
{
slice(0, str.length - 1)
}
Hi,
How can i remove the Last comma on One expression?