I’m running through the Client Security Hash exercise. I’ve completed it but when I upload it for testing, I’m getting a 0/100. I think this is due to there being a space inside my hash formula.
As you can see above, Client ID and Name come through just fine. But Country is failing with that darn space. Any help with this would be great.
In your invoke workflow for generate hash god, under in_HashFormula input argument you are passing the combination. In there, just add a trim to the ClientCountry. It will solve the problem.
First take the red colored part
Here, TempID(2) contains some string. And you add a Trim to that. This will remove the spaces in front and at the end of the string. But will not really remove the spaces in between.
Example
" Country Name: Alaska "
Your trim here will make this string like this
“Country Name: Alaska”
Now get to the blue part.
Here you split that trimmed string again by the “:” character and you take the second element
So this is what happens when you split
1st element
“Country Name”
" Alaska"
You see, when split by that character, you actually have a space after that character. That’s why you are getting that space there.
So your code should be changed a bit like this
tempid(2).Trim.Split(":"c)(1).ToString.Trim
Thank you so much for this! Being able to understand something is so much better than just inserting some code that works. Again, thank you. You’ve made someone a better code monkey today