Challenge #2: Provide equivalent relevance using different inspector

Can you provide equivalent relevance that returns the last character of a string, but without using the character inspector, or uses the character or length inspector in a very different way?

Send me answer(s) in a private message. I’ll list those that provide a correct answer. There are many different correct answers.

Q: (character (length of it - 1) of it) of "1234E"
A: E
T: 0.032 ms
I: singular substring

Correct answers:


Tip: Use the Fixlet Debugger or QnA or similar to test relevance.
Reference: https://developer.bigfix.com/relevance/reference/string.html or similar.


Other Challenges:

2 Likes

This was my use case to write this relevance in the first place: https://bigfix.me/analysis/details/2998509

I’m using it to trim the very last character off of a string. There is probably a better way to do it, but it was what I came up with first.

The Answers:

Answers (click to reveal)

By @Aram , @randy , @BrianCanFixIT , @techadmin , @selimgoksu , @JasonWalker , @brolly33 , @strawgate

Q: last 1 of "1234E"
A: E

By @Aram

character ((number of (if length of it >= 1 then firsts 1 of it else it) of (it & following text of it) of characters whose (start of it mod 1 = 0) of it - 1) of "1234E") of "1234E"

By @BaiYunfei , @brolly33

Q: substring (length of it - 1,1) of string "1234E"
A: E

By @selimgoksu

Q: (matches (regex ".$") of "1234E")
A: E 

By @zpt8mjs

parenthesized part 1 of matches (regex "(.)$") of "1234E" 

By @JasonWalker , @brolly33

Q: matches (regex (".$")) of "1234E"
A: E

By @JasonWalker

Q: substring ((maximum of positions of it - 1),1) of "1234E"
A: E 

By @brolly33

Q: following text of positions whose (it = (maximum of positions of "1234E" - 1)) of "1234E"
A: E 
2 Likes