How we will covert ("INDIA") TO {"I","N","D","I","A"}. How we will write in expression rule?
Discussion posts and replies are publicly visible
Hi pd, my solution:
a!forEach( items: enumerate(len("INDIA"))+1, expression:charat( "INDIA", fv!item) )
a!localVariables( local!string: "INDIA", charat(local!string, 1 + enumerate(len(local!string))) )
ah nice to know.-> but again a function which is not really explained that its taking an array of integer as well.documentation says (integer)
True. I complained about this at the Appian product team and the documentation team.
1st way:
{ a!localVariables( local!Arry: stripwith(trim("INDIA"), " "), local!len: len(local!Arry), a!forEach( items: enumerate(local!len) + 1, expression: a!forEach( items: local!Arry[fv!item], expression: fv!item ) ) )}
2nd way:
{ a!localVariables( local!word: stripwith(trim("INDIA"), " "), char(code(local!word)), ) }
Let me introduce you to "code()", which splits any string into an array of the character codes. Then "char()" which, if applied to an array, provides the characters for those codes (but still in an array).
char(code("INDIA"))
Honestly with as much as certain people around here (*ahem*) obsess over coming up with the shortest-possible-code for things even at the sacrifice of any readability, I'm shocked nobody beat me to this Edit to add: I see Bejjenki included something similar (but, strangely, more verbose for some reason) in his "2nd way" above.
Before using code(), i was just using index().
Yeah - and on that note, I've always kinda wondered why there isn't a less-hacky way to convert a string into an array of letters/characters, honestly. Though char(code()) is pretty compact, and the need has been infrequent (if ever), so I don't really sweat it.
Lol, sorry Mike. Still need to know when you and Stephan sleep so I can try for 50 answers achievement.
LOL, i'm just a lazy east coast 9-5er. I usually have no visibility into community when my day's done